Class: Fuelcell::Action::ArgDefinition
- Inherits:
-
Object
- Object
- Fuelcell::Action::ArgDefinition
- Defined in:
- lib/fuelcell/action/arg_definition.rb
Constant Summary collapse
- NO_DEFAULT_ASSIGNED =
'__fuelcell_no_default_assigned__'
Instance Attribute Summary collapse
-
#banner ⇒ Object
readonly
Returns the value of attribute banner.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
(also: #required?)
readonly
Returns the value of attribute required.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #default? ⇒ Boolean
-
#initialize(text, config = {}) ⇒ ArgDefinition
constructor
A new instance of ArgDefinition.
Constructor Details
#initialize(text, config = {}) ⇒ ArgDefinition
Returns a new instance of ArgDefinition.
9 10 11 12 13 14 15 |
# File 'lib/fuelcell/action/arg_definition.rb', line 9 def initialize(text, config = {}) @name = text.to_s @required = config[:required] == true ? true : false @type = validate_type(config[:type]) @default = config.fetch(:default) { NO_DEFAULT_ASSIGNED } = config[:banner] || '' end |
Instance Attribute Details
#banner ⇒ Object (readonly)
Returns the value of attribute banner.
5 6 7 |
# File 'lib/fuelcell/action/arg_definition.rb', line 5 def end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
5 6 7 |
# File 'lib/fuelcell/action/arg_definition.rb', line 5 def default @default end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/fuelcell/action/arg_definition.rb', line 5 def name @name end |
#required ⇒ Object (readonly) Also known as: required?
Returns the value of attribute required.
5 6 7 |
# File 'lib/fuelcell/action/arg_definition.rb', line 5 def required @required end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/fuelcell/action/arg_definition.rb', line 5 def type @type end |
Instance Method Details
#default? ⇒ Boolean
17 18 19 |
# File 'lib/fuelcell/action/arg_definition.rb', line 17 def default? @default == NO_DEFAULT_ASSIGNED ? false : true end |