Class: Valise::Stack
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from ItemEnum
#absent, #present, #writable
Methods included from Unpath
#repath, #unpath
Constructor Details
#initialize(path, set, merge_class, dump_load) ⇒ Stack
Returns a new instance of Stack.
134
135
136
137
138
139
|
# File 'lib/valise/stack.rb', line 134
def initialize(path, set, merge_class, dump_load)
@segments = unpath(path)
@valise = set
@merge_diff = (merge_class || MergeDiff::TopMost).new(self)
@dump_load = dump_load
end
|
Instance Attribute Details
#segments ⇒ Object
Returns the value of attribute segments.
141
142
143
|
# File 'lib/valise/stack.rb', line 141
def segments
@segments
end
|
Instance Method Details
#below(item) ⇒ Object
155
156
157
|
# File 'lib/valise/stack.rb', line 155
def below(item)
Stack.new(@segments, @valise.below(item.root), @merge_diff.class, @dump_load)
end
|
#diffed(item, value) ⇒ Object
147
148
149
|
# File 'lib/valise/stack.rb', line 147
def diffed(item, value)
@merge_diff.diff(item, value)
end
|
#each ⇒ Object
159
160
161
162
163
|
# File 'lib/valise/stack.rb', line 159
def each
@valise.each do |root|
yield(Item.new(self, root, @dump_load))
end
end
|
#inspect ⇒ Object
130
131
132
|
# File 'lib/valise/stack.rb', line 130
def inspect
"<default>:#{@segments.join "/"} #{@valise.inspect}"
end
|
#merged(item) ⇒ Object
143
144
145
|
# File 'lib/valise/stack.rb', line 143
def merged(item)
@merge_diff.merge(item)
end
|
#not_above(item) ⇒ Object
151
152
153
|
# File 'lib/valise/stack.rb', line 151
def not_above(item)
Stack.new(@segments, @valise.not_above(item.root), @merge_diff.class, @dump_load)
end
|
#reverse ⇒ Object
165
166
167
|
# File 'lib/valise/stack.rb', line 165
def reverse
Stack.new(@segments, @valise.reverse, @merge_diff.class, @dump_load)
end
|