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
379 380 381 382 |
# File 'lib/heroics/schema.rb', line 379 def initialize(resource_name, parameters) @resource_name = resource_name @parameters = parameters end |
Instance Attribute Details
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
377 378 379 |
# File 'lib/heroics/schema.rb', line 377 def parameters @parameters end |
#resource_name ⇒ Object (readonly)
Returns the value of attribute resource_name.
377 378 379 |
# File 'lib/heroics/schema.rb', line 377 def resource_name @resource_name end |
Instance Method Details
#description ⇒ Object
A description created by merging individual parameter descriptions.
397 398 399 |
# File 'lib/heroics/schema.rb', line 397 def description @parameters.map { |parameter| parameter.description }.join(' or ') end |
#inspect ⇒ Object
A pretty representation of this instance.
402 403 404 |
# File 'lib/heroics/schema.rb', line 402 def inspect "ParameterChoice(parameters=#{@parameters})" end |
#name ⇒ Object
A name created by merging individual parameter descriptions, suitable for use in a function signature.
386 387 388 389 390 391 392 393 394 |
# File 'lib/heroics/schema.rb', line 386 def name @parameters.map do |parameter| if parameter.resource_name parameter.name else "#{@resource_name}_#{parameter.name}" end end.join('_or_') end |