Module: Vissen::Parameterized::DSL
- Defined in:
- lib/vissen/parameterized/dsl.rb
Overview
Instance Method Summary collapse
-
#class_output ⇒ Value?
A new instance of the value class defined using ‘#output`, or nil if nothing was defined.
-
#class_parameters ⇒ Hash<Symbol, Parameter>
A new hash containing one parameter object for each parameter key.
- #output(value_klass) ⇒ nil
- #param(key, value_klass, default: nil) ⇒ nil
Instance Method Details
#class_output ⇒ Value?
Returns a new instance of the value class defined using ‘#output`, or nil if nothing was defined.
48 49 50 51 |
# File 'lib/vissen/parameterized/dsl.rb', line 48 def class_output return nil unless defined? @_output @_output.new end |
#class_parameters ⇒ Hash<Symbol, Parameter>
Returns a new hash containing one parameter object for each parameter key.
37 38 39 40 41 42 |
# File 'lib/vissen/parameterized/dsl.rb', line 37 def class_parameters return {}.freeze unless defined? @_params @_params.each_with_object({}) { |(k, v), h| h[k] = Parameter.new(*v) } .freeze end |
#output(value_klass) ⇒ nil
30 31 32 33 |
# File 'lib/vissen/parameterized/dsl.rb', line 30 def output(value_klass) @_output = value_klass nil end |
#param(key, value_klass, default: nil) ⇒ nil
22 23 24 25 26 |
# File 'lib/vissen/parameterized/dsl.rb', line 22 def param(key, value_klass, default: nil) @_params = {} unless defined? @_params @_params[key] = [value_klass, default].freeze nil end |