class Fattr::List
Attributes
object[RW]
Public Class Methods
new(*args, &block)
click to toggle source
Calls superclass method
# File lib/fattr.rb, line 9 def initialize(*args, &block) super(*args, &block) end
Public Instance Methods
<<(element)
click to toggle source
Calls superclass method
# File lib/fattr.rb, line 13 def << element super self ensure uniq! index! end
for(object)
click to toggle source
# File lib/fattr.rb, line 46 def for(object) @object = object self end
include?(element)
click to toggle source
# File lib/fattr.rb, line 26 def include?(element) @index ||= Hash.new @index[element.to_s] ? true : false end
index!()
click to toggle source
# File lib/fattr.rb, line 21 def index! @index ||= Hash.new each{|element| @index[element.to_s] = true} end
initializers()
click to toggle source
# File lib/fattr.rb, line 31 def initializers @initializers ||= Hash.new end
to_h()
click to toggle source
# File lib/fattr.rb, line 42 def to_h to_hash end
to_hash()
click to toggle source
# File lib/fattr.rb, line 35 def to_hash if @object list = @object.class.fattrs + @object.fattrs list.inject(Hash.new){|hash, fattr| hash.update(fattr => @object.send(fattr))} end end