Class: OReflect::Param
- Inherits:
-
Object
- Object
- OReflect::Param
- Includes:
- Accessors
- Defined in:
- lib/oreflect/param.rb
Instance Method Summary collapse
- #as_hash(*exclusions) ⇒ Object
-
#initialize(key, &block) ⇒ Param
constructor
A new instance of Param.
Methods included from Accessors
Constructor Details
#initialize(key, &block) ⇒ Param
Returns a new instance of Param.
11 12 13 14 |
# File 'lib/oreflect/param.rb', line 11 def initialize(key, &block) @key = key instance_eval(&block) if block_given? end |
Instance Method Details
#as_hash(*exclusions) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/oreflect/param.rb', line 16 def as_hash(*exclusions) h = {} h[:is_required] = is_required? h[:is_multiparam] = is_multiparam? h[:key] = key h[:description] = description h[:examples] = examples h[:accepted_values] = accepted_values h[:required_params] = required_params h[:excluded_params] = excluded_params exclusions.each { |key| h.delete(key) } h end |