Class: SoftLayer::ObjectFilterOperation
- Inherits:
-
Object
- Object
- SoftLayer::ObjectFilterOperation
- Defined in:
- lib/softlayer/ObjectFilter.rb
Overview
A class whose instances represent an Object Filter operation.
Instance Attribute Summary collapse
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(operator, value) ⇒ ObjectFilterOperation
constructor
A new instance of ObjectFilterOperation.
- #to_h ⇒ Object
Constructor Details
#initialize(operator, value) ⇒ ObjectFilterOperation
Returns a new instance of ObjectFilterOperation.
43 44 45 46 47 48 49 |
# File 'lib/softlayer/ObjectFilter.rb', line 43 def initialize(operator, value) raise ArgumentException, "An unknown operator was given" if !OBJECT_FILTER_OPERATORS.include?(operator.strip) raise ArgumentException, "Expected a value" if value.nil? || (value.respond_to?(:empty?) && value.empty?) @operator = operator.strip @value = value.strip end |
Instance Attribute Details
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
40 41 42 |
# File 'lib/softlayer/ObjectFilter.rb', line 40 def operator @operator end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
41 42 43 |
# File 'lib/softlayer/ObjectFilter.rb', line 41 def value @value end |
Instance Method Details
#to_h ⇒ Object
51 52 53 |
# File 'lib/softlayer/ObjectFilter.rb', line 51 def to_h { 'operation' => "#{operator} #{value}"} end |