Module: AttributeTypeMethods
- Included in:
- EasyJSONMatcher::NodeGenerator
- Defined in:
- lib/easy_json_matcher/attribute_type_methods.rb
Instance Method Summary collapse
- #has_boolean(key:, opts: []) ⇒ Object (also: #boolean)
- #has_booleans(keys:, opts: []) ⇒ Object
- #has_date(key:, opts: []) ⇒ Object (also: #date)
- #has_dates(keys:, opts: []) ⇒ Object
- #has_number(key:, opts: []) ⇒ Object (also: #number)
- #has_numbers(keys:, opts: []) ⇒ Object
- #has_object(key:, opts: []) ⇒ Object (also: #object)
- #has_objects(keys:, opts: []) ⇒ Object
- #has_string(key:, opts: []) ⇒ Object (also: #string)
- #has_strings(keys:, opts: []) ⇒ Object
- #has_value(key:, opts: []) ⇒ Object (also: #value)
- #has_values(keys:, opts: []) ⇒ Object
- #mass_assign(keys:, opts: [], meth:) ⇒ Object
Instance Method Details
#has_boolean(key:, opts: []) ⇒ Object Also known as: boolean
4 5 6 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 4 def has_boolean(key:, opts: []) has_attribute(key: key, opts: opts + [:boolean]) end |
#has_booleans(keys:, opts: []) ⇒ Object
32 33 34 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 32 def has_booleans(keys:, opts: []) mass_assign(keys: keys, opts: opts, meth: :has_boolean) end |
#has_date(key:, opts: []) ⇒ Object Also known as: date
12 13 14 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 12 def has_date(key:, opts: []) has_attribute(key: key, opts: opts + [:date]) end |
#has_dates(keys:, opts: []) ⇒ Object
48 49 50 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 48 def has_dates(keys:, opts: []) mass_assign(keys: keys, opts: opts, meth: :has_date) end |
#has_number(key:, opts: []) ⇒ Object Also known as: number
8 9 10 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 8 def has_number(key: , opts: []) has_attribute(key: key, opts: opts + [:number] ) end |
#has_numbers(keys:, opts: []) ⇒ Object
36 37 38 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 36 def has_numbers(keys:, opts: []) mass_assign(keys: keys, opts: opts, meth: :has_number) end |
#has_object(key:, opts: []) ⇒ Object Also known as: object
16 17 18 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 16 def has_object(key:, opts: []) has_attribute(key: key, opts: opts + [:object]) end |
#has_objects(keys:, opts: []) ⇒ Object
40 41 42 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 40 def has_objects(keys:, opts: []) mass_assign(keys: keys, opts: opts, meth: :has_object) end |
#has_string(key:, opts: []) ⇒ Object Also known as: string
24 25 26 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 24 def has_string(key:, opts: []) has_attribute(key: key, opts: opts + [:string]) end |
#has_strings(keys:, opts: []) ⇒ Object
28 29 30 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 28 def has_strings(keys:, opts: []) mass_assign(keys: keys, opts: opts, meth: :has_string) end |
#has_value(key:, opts: []) ⇒ Object Also known as: value
20 21 22 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 20 def has_value(key:, opts: []) has_attribute(key: key, opts: opts + [:value]) end |
#has_values(keys:, opts: []) ⇒ Object
44 45 46 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 44 def has_values(keys:, opts: []) mass_assign(keys: keys, opts: opts, meth: :has_value) end |
#mass_assign(keys:, opts: [], meth:) ⇒ Object
52 53 54 |
# File 'lib/easy_json_matcher/attribute_type_methods.rb', line 52 def mass_assign(keys:, opts: [], meth:) keys.each { |k| self.send(meth, { key: k, opts: opts }) } end |