Class: Drudge::Parsers::ParseResults::Seq
- Inherits:
-
Struct
- Object
- Struct
- Drudge::Parsers::ParseResults::Seq
show all
- Includes:
- ParseValue
- Defined in:
- lib/drudge/parsers/parse_results.rb
Overview
A sequence of succesful results
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from ParseValue
zero
#Empty, #Error, #Failure, #Seq, #Single, #Success
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value
221
222
223
|
# File 'lib/drudge/parsers/parse_results.rb', line 221
def value
@value
end
|
Instance Method Details
#+(other) ⇒ Object
232
233
234
235
236
237
238
239
240
241
242
243
244
|
# File 'lib/drudge/parsers/parse_results.rb', line 232
def +(other)
case other
when Empty
self
when Single
Seq(self.value + [other.value])
when Seq
Seq(self.value + other.value)
end
end
|
#flat_map {|value| ... } ⇒ Object
228
229
230
|
# File 'lib/drudge/parsers/parse_results.rb', line 228
def flat_map
yield value
end
|
#map ⇒ Object
224
225
226
|
# File 'lib/drudge/parsers/parse_results.rb', line 224
def map
self.class.new(yield value)
end
|
#to_a ⇒ Object
246
247
248
|
# File 'lib/drudge/parsers/parse_results.rb', line 246
def to_a
value
end
|