demo:
class A
end
t = :name
if t.is_a?(Symbol) # true
puts 't true'
end
if A.is_a?(Symbol) # false
puts 'A true'
end
if 12.is_a?(Integer) #true
puts '12'
endref:
http://www.ruby-doc.org/core/classes/Symbol.html
http://www.ruby-doc.org/docs/Tutorial/part_01/objects.html
posted on 2009-07-14 11:53
fl1429 閱讀(1196)
評論(0) 編輯 收藏 所屬分類:
Rails