Class: Jade::Decode::Desc::Optional
- Inherits:
-
Data
- Object
- Data
- Jade::Decode::Desc::Optional
- Includes:
- Node
- Defined in:
- lib/jade/decode.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#inner ⇒ Object
readonly
Returns the value of attribute inner.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
Methods included from Node
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default
137 138 139 |
# File 'lib/jade/decode.rb', line 137 def default @default end |
#inner ⇒ Object (readonly)
Returns the value of attribute inner
137 138 139 |
# File 'lib/jade/decode.rb', line 137 def inner @inner end |
#key ⇒ Object (readonly)
Returns the value of attribute key
137 138 139 |
# File 'lib/jade/decode.rb', line 137 def key @key end |
Instance Method Details
#decode(value) ⇒ Object
140 141 142 143 144 145 146 147 148 |
# File 'lib/jade/decode.rb', line 140 def decode(value) h = coerce_hash(value) return type_err('Object', value) unless h raw = at_key(h, key.to_sym, key) return default if ABSENT.equal?(raw) || raw.nil? at_field(key.to_s, inner.decode(raw)) end |