Class: Heroics::ParameterChoice
- Inherits:
-
Object
- Object
- Heroics::ParameterChoice
- Defined in:
- lib/heroics/schema.rb
Overview
A representation of a set of parameters.
Instance Attribute Summary collapse
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#resource_name ⇒ Object
readonly
Returns the value of attribute resource_name.
Instance Method Summary collapse
-
#description ⇒ Object
A description created by merging individual parameter descriptions.
-
#initialize(resource_name, parameters) ⇒ ParameterChoice
constructor
A new instance of ParameterChoice.
-
#inspect ⇒ Object
A pretty representation of this instance.
-
#name ⇒ Object
A name created by merging individual parameter descriptions, suitable for use in a function signature.
Constructor Details
#initialize(resource_name, parameters) ⇒ ParameterChoice
Returns a new instance of ParameterChoice.
388 389 390 391 |
# File 'lib/heroics/schema.rb', line 388 def initialize(resource_name, parameters) @resource_name = resource_name @parameters = parameters end |
Instance Attribute Details
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
386 387 388 |
# File 'lib/heroics/schema.rb', line 386 def parameters @parameters end |
#resource_name ⇒ Object (readonly)
Returns the value of attribute resource_name.
386 387 388 |
# File 'lib/heroics/schema.rb', line 386 def resource_name @resource_name end |
Instance Method Details
#description ⇒ Object
A description created by merging individual parameter descriptions.
406 407 408 |
# File 'lib/heroics/schema.rb', line 406 def description @parameters.map { |parameter| parameter.description }.join(' or ') end |
#inspect ⇒ Object
A pretty representation of this instance.
411 412 413 |
# File 'lib/heroics/schema.rb', line 411 def inspect "ParameterChoice(parameters=#{@parameters})" end |
#name ⇒ Object
A name created by merging individual parameter descriptions, suitable for use in a function signature.
395 396 397 398 399 400 401 402 403 |
# File 'lib/heroics/schema.rb', line 395 def name @parameters.map do |parameter| if parameter.resource_name parameter.name else "#{@resource_name}_#{parameter.name}" end end.join('_or_') end |