Class: Fuelcell::Action::ArgDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/fuelcell/action/arg_definition.rb

Constant Summary collapse

NO_DEFAULT_ASSIGNED =
'__fuelcell_no_default_assigned__'

Instance Attribute Summary collapse

Instance Method Summary collapse

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 }
  @banner   = config[:banner] || ''
end

Instance Attribute Details

Returns the value of attribute banner.



5
6
7
# File 'lib/fuelcell/action/arg_definition.rb', line 5

def banner
  @banner
end

#defaultObject (readonly)

Returns the value of attribute default.



5
6
7
# File 'lib/fuelcell/action/arg_definition.rb', line 5

def default
  @default
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/fuelcell/action/arg_definition.rb', line 5

def name
  @name
end

#requiredObject (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

#typeObject (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

Returns:

  • (Boolean)


17
18
19
# File 'lib/fuelcell/action/arg_definition.rb', line 17

def default?
  @default == NO_DEFAULT_ASSIGNED ? false : true
end