class Scorched::Collection
Attributes
append_parent[RW]
If true, parent values are appended to self. The default behavior is to append self to the parent values.
Public Instance Methods
inspect()
click to toggle source
# File lib/scorched/collection.rb, line 35 def inspect "#<#{self.class}(#{super}, #{to_set.inspect})>" end
parent!(parent)
click to toggle source
Sets parent Collection
object and returns self
# File lib/scorched/collection.rb, line 14 def parent!(parent) @parent = parent self end
to_a(inherit = true)
click to toggle source
# File lib/scorched/collection.rb, line 31 def to_a(inherit = true) to_set(inherit).to_a end
to_set(inherit = true)
click to toggle source
# File lib/scorched/collection.rb, line 19 def to_set(inherit = true) if inherit && (Set === @parent || Array === @parent) if append_parent Set.new.merge(self._to_a).merge(@parent.to_set) else Set.new.merge(@parent.to_set).merge(self._to_a) end else Set.new.merge(self._to_a) end end