Class: SoftLayer::ObjectFilterBlockHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/softlayer/ObjectFilter.rb

Overview

This class defines the routines that are valid within the block provided to a call to ObjectFilter.build. This allows you to create object filters like:

object_filter = SoftLayer::ObjectFilter.build("hardware.memory") { is_greater_than(2) }

Instance Method Summary collapse

Instance Method Details

#begins_with(value) ⇒ Object

Matches when the value is found at the beginning of the field. This search is not case sensitive



77
78
79
# File 'lib/softlayer/ObjectFilter.rb', line 77

def begins_with(value)
  ObjectFilterOperation.new('^=', value)
end

#contains(value) ⇒ Object

Matches when the value is found within the field the search is not case sensitive



71
72
73
# File 'lib/softlayer/ObjectFilter.rb', line 71

def contains(value)
  ObjectFilterOperation.new('*=', value)
end

#contains_exactly(value) ⇒ Object

Matches when the value is found within the field the search is case sensitive



121
122
123
# File 'lib/softlayer/ObjectFilter.rb', line 121

def contains_exactly(value)
  ObjectFilterOperation.new('~', value)
end

#does_not_contain(value) ⇒ Object

Matches when the value is not found within the field the search is case sensitive



127
128
129
# File 'lib/softlayer/ObjectFilter.rb', line 127

def does_not_contain(value)
  ObjectFilterOperation.new('!~', value)
end

#ends_with(value) ⇒ Object

Matches when the value is found at the end of the field. This search is not case sensitive



83
84
85
# File 'lib/softlayer/ObjectFilter.rb', line 83

def ends_with(value)
  ObjectFilterOperation.new('$=', value)
end

#is(value) ⇒ Object

Matches when the value in the field is exactly equal to the given value. This is a case-sensitive match



89
90
91
# File 'lib/softlayer/ObjectFilter.rb', line 89

def is(value)
  ObjectFilterOperation.new('_=', value)
end

#is_greater_or_equal_to(value) ⇒ Object

Matches when the value in the field is greater than or equal to the given value



110
111
112
# File 'lib/softlayer/ObjectFilter.rb', line 110

def is_greater_or_equal_to(value)
  ObjectFilterOperation.new('>=', value)
end

#is_greater_than(value) ⇒ Object

Matches when the value in the field is greater than the given value



100
101
102
# File 'lib/softlayer/ObjectFilter.rb', line 100

def is_greater_than(value)
  ObjectFilterOperation.new('>', value)
end

#is_less_or_equal_to(value) ⇒ Object

Matches when the value in the field is less than or equal to the given value



115
116
117
# File 'lib/softlayer/ObjectFilter.rb', line 115

def is_less_or_equal_to(value)
  ObjectFilterOperation.new('<=', value)
end

#is_less_than(value) ⇒ Object

Matches when the value in the field is less than the given value



105
106
107
# File 'lib/softlayer/ObjectFilter.rb', line 105

def is_less_than(value)
  ObjectFilterOperation.new('<', value)
end

#is_not(value) ⇒ Object

Matches is the value in the field does not exactly equal the value passed in.



95
96
97
# File 'lib/softlayer/ObjectFilter.rb', line 95

def is_not(value)
  ObjectFilterOperation.new('!=', value)
end