Ruby

http://www.ruby-lang.org/ja/

./configure --help
./configure --enable-shared

Eclipse http://ja.netbeans.org/

gem install ruby-debug-ide
/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin 

ln -s /Library/Ruby/Gems/1.8/gems/ruby-debug-ide-0.1.9/bin/rdebug-ide


http://completemirage.blog55.fc2.com/blog-entry-39.html

irb

TIPS


#
=begin
=end

p "hoge".object_id == "hoge".object_id
>false
p :hoge.object_id == :hoge.object_id
>true

yield

class TestClass
 attr_accessor :name1
 attr_accessor :name2

 def initialize()
   @test = Array.new
   @test.push("aaaa")
   @test.push("bbb")
   @test.push("ccc")
 end
 def hoge
   yield(10,20)

   yield(10,20)
 end
 def hoge2
   @test.each{|tes|
     yield(tes)
   }
 end
 def hoge3
   yield(name1,name2)
 end
end

testclass = TestClass.new
testclass.hoge{|x,y| p x*y}
testclass.hoge2{|aa| p aa.length}


testclass.hoge3{|aa,bb| puts aa+bb}
200
200
4
3
3

false
true 

pp

require 'pp'
pp hoge
p hoge.methods
p hoge.public_methods
p hoge.private_methods
p hoge.protected_methods

hash

map

a = [10, 20, 30, 40, 50]
a.map! {|x| x*10}
p a  #=>[100, 200, 300, 400, 500]
a.map {|x| x*10}
p a  #=>[100, 200, 300, 400, 500]
newcart = Marshal.load(Marshal.dump(cart))

Marshal

net/http

   query_hash = Hash.new
   query_hash["va"] = "hoge"

   query_string = query_hash.map{|key,value|
     "#{URI.encode(key)}=#{URI.encode(value)}"
   }.join("&")

   begin
     Net::HTTP.start('search.yahoo.co.jp', 80) {|http|
       response = http.post('/web/advanced',query_string)
       p response.body
     }
   rescue
     puts "exception on HTTP: #{$!}"
   end

WWW::Mechanize

require 'mechanize'
agent = WWW::Mechanize.new
page = agent.get('http://search.yahoo.co.jp/web/advanced')
form = page.forms.first
form.va  = "hoge"
res = agent.submit(form)
resbody = res.body
p resbody

Hpricot



hashhoge2 = hashhoge.sort_by{|key,val|val}

etc

http://wiki.rubyonrails.com/rails/pages/RailsOnFedora
http://osakanas.blog19.fc2.com/blog-entry-67.html
http://www.goodpic.com/mt/archives2/2005/10/fedora_core_3_r.html

DB

MySQL

gem install mysql -- --with-mysql-dir=/usr/local/mysql
;C:\Program Files\MySQL\MySQL Server 5.0\bin;

PostgreSQL

http://www.postgresql.jp/interfaces/ruby/index-ja.html

Apollo

http://www.moriq.com/apollo/


Ruby on Rails



トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS