27 lines
606 B
Ruby
27 lines
606 B
Ruby
|
module Sof
|
||
|
module Util
|
||
|
def is_value? o
|
||
|
return true if o == true
|
||
|
return true if o == false
|
||
|
return true if o == nil
|
||
|
return true if o.class == Fixnum
|
||
|
return true if o.class == Symbol
|
||
|
return true if o.class == String
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
def get_value(object,name)
|
||
|
object.instance_variable_get "@#{name}".to_sym
|
||
|
end
|
||
|
|
||
|
def attributes_for object
|
||
|
if( Known.is( object.class ))
|
||
|
Known.attributes(object.class)
|
||
|
else
|
||
|
object.instance_variables.collect{|i| i.to_s[1..-1].to_sym } # chop of @
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|
||
|
end
|