Class: Specifind::Operator
- Inherits:
-
Object
- Object
- Specifind::Operator
- Defined in:
- lib/specifind/operator.rb
Overview
The data are held in the class definition as a list of identifying Strings.
Constant Summary collapse
- @@operators_data =
%w(_and_)
- @@operators =
[]
Instance Attribute Summary collapse
-
#pattern ⇒ Object
Returns the value of attribute pattern.
Class Method Summary collapse
-
.find(s) ⇒ Object
find an operator object based on identifying string.
-
.operators ⇒ Object
list of operator objects.
-
.operators=(o) ⇒ Object
set list of operator objects.
-
.patterns ⇒ Object
list of operator objects’ patterns.
Instance Method Summary collapse
-
#initialize(args) ⇒ Operator
constructor
A new instance of Operator.
Constructor Details
Instance Attribute Details
#pattern ⇒ Object
Returns the value of attribute pattern.
9 10 11 |
# File 'lib/specifind/operator.rb', line 9 def pattern @pattern end |
Class Method Details
.find(s) ⇒ Object
find an operator object based on identifying string
29 30 31 32 |
# File 'lib/specifind/operator.rb', line 29 def self.find(s) @@operators.each{|o| return o if o.pattern == s} nil end |
.operators ⇒ Object
list of operator objects
12 13 14 |
# File 'lib/specifind/operator.rb', line 12 def self.operators @@operators end |
.operators=(o) ⇒ Object
set list of operator objects
17 18 19 |
# File 'lib/specifind/operator.rb', line 17 def self.operators=(o) @@operators = o end |
.patterns ⇒ Object
list of operator objects’ patterns
22 23 24 25 26 |
# File 'lib/specifind/operator.rb', line 22 def self.patterns a = [] @@operators.each{|c| a << c.pattern} a end |