Class: Lisp::Format::Parameters::Parameter
- Defined in:
- lib/carat/lisp-format.rb
Overview
Base class from which the sub-classes get their behavior. Every parameter should sub-class from this class.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#pos ⇒ Object
readonly
Position in the input format that this parameter was found.
Instance Method Summary collapse
-
#initialize(pos, value = nil) ⇒ Parameter
constructor
Create a parameter, found at
pos
in the input format, and withvalue
as its value - if it has one. -
#value(state, default) ⇒ Object
Retrieve this parameters value in the given State, using
default
if it is not defined.
Constructor Details
#initialize(pos, value = nil) ⇒ Parameter
Create a parameter, found at pos
in the input format, and with value
as its value - if it has one.
432 433 434 |
# File 'lib/carat/lisp-format.rb', line 432 def initialize(pos, value = nil) @pos, @value = pos, value end |
Instance Attribute Details
#pos ⇒ Object (readonly)
Position in the input format that this parameter was found.
443 444 445 |
# File 'lib/carat/lisp-format.rb', line 443 def pos @pos end |
Instance Method Details
#value(state, default) ⇒ Object
Retrieve this parameters value in the given State, using default
if it is not defined.
438 439 440 |
# File 'lib/carat/lisp-format.rb', line 438 def value(state, default) @value or default end |