Class: Relax::Parameter
- Inherits:
-
Object
- Object
- Relax::Parameter
- Defined in:
- lib/relax/parameter.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
- #value ⇒ Object
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Parameter
constructor
A new instance of Parameter.
- #named?(name) ⇒ Boolean
- #required? ⇒ Boolean
Constructor Details
#initialize(name, options = {}) ⇒ Parameter
Returns a new instance of Parameter.
6 7 8 9 |
# File 'lib/relax/parameter.rb', line 6 def initialize(name, ={}) @name = name @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/relax/parameter.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/relax/parameter.rb', line 3 def @options end |
#value ⇒ Object
15 16 17 |
# File 'lib/relax/parameter.rb', line 15 def value @value || @options[:default] end |
Instance Method Details
#named?(name) ⇒ Boolean
11 12 13 |
# File 'lib/relax/parameter.rb', line 11 def named?(name) name == (@options[:as] || @name) end |
#required? ⇒ Boolean
19 20 21 |
# File 'lib/relax/parameter.rb', line 19 def required? @options[:required] end |