Class: RSpecOutlines::OutlineBinding
- Inherits:
-
Object
- Object
- RSpecOutlines::OutlineBinding
- Defined in:
- lib/rspec_outlines.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #defined?(name) ⇒ Boolean
-
#initialize(names = [], values = []) ⇒ OutlineBinding
constructor
A new instance of OutlineBinding.
- #merge(names, values) ⇒ Object
Constructor Details
#initialize(names = [], values = []) ⇒ OutlineBinding
Returns a new instance of OutlineBinding.
112 113 114 115 |
# File 'lib/rspec_outlines.rb', line 112 def initialize(names=[], values=[]) @fields = {} merge!(names, values) end |
Instance Method Details
#[](name) ⇒ Object
127 128 129 |
# File 'lib/rspec_outlines.rb', line 127 def [](name) @fields[name] end |
#defined?(name) ⇒ Boolean
123 124 125 |
# File 'lib/rspec_outlines.rb', line 123 def defined?(name) @fields.key?(name) end |
#merge(names, values) ⇒ Object
117 118 119 120 121 |
# File 'lib/rspec_outlines.rb', line 117 def merge(names, values) names.length == values.length or raise ArgumentError, "wrong number of values (#{fields.length} fields, #{values.length} values given)" dup.merge!(names, values) end |