Class: Yaparc::Item

Inherits:
Object
  • Object
show all
Includes:
Parsable
Defined in:
lib/yaparc/item.rb

Constant Summary

Constants included from Parsable

Parsable::IS_ALPHANUM, Parsable::IS_CR, Parsable::IS_DIGIT, Parsable::IS_LOWER, Parsable::IS_SPACE, Parsable::IS_WHITESPACE

Instance Method Summary collapse

Methods included from Parsable

#parse

Constructor Details

#initializeItem

Returns a new instance of Item.



7
8
9
10
11
12
13
14
15
# File 'lib/yaparc/item.rb', line 7

def initialize
  @parser = lambda do |input|
    if input.nil? || input.empty?
      Fail.new(input:)
    else
      OK.new(value: input[0], input: input[1..])
    end
  end
end