rubyx/lib/sof/util.rb

24 lines
574 B
Ruby
Raw Normal View History

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
attributes = object.instance_variables.collect{|i| i.to_s[1..-1].to_sym } # chop of @
attributes - Volotile.attributes(object.class)
end
end
end