Class: YTools::Path::Token
- Inherits:
-
Struct
- Object
- Struct
- YTools::Path::Token
- Defined in:
- lib/ytools/path/lexer.rb
Instance Attribute Summary collapse
-
#length ⇒ Object
Returns the value of attribute length.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#path ⇒ Object
Returns the value of attribute path.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#length ⇒ Object
Returns the value of attribute length
5 6 7 |
# File 'lib/ytools/path/lexer.rb', line 5 def length @length end |
#offset ⇒ Object
Returns the value of attribute offset
5 6 7 |
# File 'lib/ytools/path/lexer.rb', line 5 def offset @offset end |
#path ⇒ Object
Returns the value of attribute path
5 6 7 |
# File 'lib/ytools/path/lexer.rb', line 5 def path @path end |
#type ⇒ Object
Returns the value of attribute type
5 6 7 |
# File 'lib/ytools/path/lexer.rb', line 5 def type @type end |
Instance Method Details
#value ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ytools/path/lexer.rb', line 6 def value case type when :path_separator then '/' when :path_part then path # We cheat and put in the actual # value of the path part here, # because we don't care about the offset when :lbrace then '[' when :rbrace then ']' when :number then path[offset, length].to_i else raise YPath::PathError("Unrecognized token type!!!!") end end |