Class: Braintree::AdvancedSearch::MultipleValueNode
- Inherits:
-
SearchNode
- Object
- SearchNode
- Braintree::AdvancedSearch::MultipleValueNode
- Defined in:
- lib/braintree/advanced_search.rb
Direct Known Subclasses
Instance Method Summary collapse
- #allowed_values ⇒ Object
- #in(*values) ⇒ Object
-
#initialize(name, parent, options) ⇒ MultipleValueNode
constructor
A new instance of MultipleValueNode.
- #is(value) ⇒ Object
Methods inherited from SearchNode
Constructor Details
#initialize(name, parent, options) ⇒ MultipleValueNode
Returns a new instance of MultipleValueNode.
51 52 53 54 |
# File 'lib/braintree/advanced_search.rb', line 51 def initialize(name, parent, ) super(name, parent) @options = end |
Instance Method Details
#allowed_values ⇒ Object
56 57 58 |
# File 'lib/braintree/advanced_search.rb', line 56 def allowed_values @options[:allows] end |
#in(*values) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/braintree/advanced_search.rb', line 40 def in(*values) values.flatten! unless allowed_values.nil? bad_values = values - allowed_values raise ArgumentError.new("Invalid argument(s) for #{@node_name}: #{bad_values.join(", ")}") if bad_values.any? end @parent.add_criteria(@node_name, values) end |
#is(value) ⇒ Object
60 61 62 |
# File 'lib/braintree/advanced_search.rb', line 60 def is(value) self.in(value) end |