Class: Operator
- Inherits:
-
Object
- Object
- Operator
- Defined in:
- lib/extensions/operator.rb
Overview
Concept from dm-core
Instance Attribute Summary collapse
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #==(rhs) ⇒ Object
-
#initialize(target, operator, prefix = false) ⇒ Operator
constructor
A new instance of Operator.
- #to_ga ⇒ Object
Constructor Details
#initialize(target, operator, prefix = false) ⇒ Operator
Returns a new instance of Operator.
5 6 7 8 9 |
# File 'lib/extensions/operator.rb', line 5 def initialize(target, operator, prefix=false) @target = target.to_ga @operator = operator @prefix = prefix end |
Instance Attribute Details
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
3 4 5 |
# File 'lib/extensions/operator.rb', line 3 def operator @operator end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
3 4 5 |
# File 'lib/extensions/operator.rb', line 3 def prefix @prefix end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
3 4 5 |
# File 'lib/extensions/operator.rb', line 3 def target @target end |
Instance Method Details
#==(rhs) ⇒ Object
15 16 17 18 19 |
# File 'lib/extensions/operator.rb', line 15 def ==(rhs) target == rhs.target && operator == rhs.operator && prefix == rhs.prefix end |
#to_ga ⇒ Object
11 12 13 |
# File 'lib/extensions/operator.rb', line 11 def to_ga @prefix ? "#{operator}#{target}" : "#{target}#{operator}" end |