Class: Jade::Decode::Desc::Idx
- Inherits:
-
Data
- Object
- Data
- Jade::Decode::Desc::Idx
- Includes:
- Node
- Defined in:
- lib/jade/decode.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#inner ⇒ Object
readonly
Returns the value of attribute inner.
Instance Method Summary collapse
Methods included from Node
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index
151 152 153 |
# File 'lib/jade/decode.rb', line 151 def index @index end |
#inner ⇒ Object (readonly)
Returns the value of attribute inner
151 152 153 |
# File 'lib/jade/decode.rb', line 151 def inner @inner end |
Instance Method Details
#decode(value) ⇒ Object
154 155 156 157 158 159 160 |
# File 'lib/jade/decode.rb', line 154 def decode(value) return type_err('Array', value) unless ::Array === value return Failure.new(MissingField["[#{index}]"]) if index >= value.length decoded = inner.decode(value[index]) decoded?(decoded) ? decoded : Failure.new(AtIndex[index, decoded.error]) end |