Class: Piglet::Field::PrefixExpression
- Inherits:
-
Object
- Object
- Piglet::Field::PrefixExpression
- Includes:
- Field
- Defined in:
- lib/piglet/field/prefix_expression.rb
Overview
:nodoc:
Constant Summary
Constants included from Field
Field::FUNCTIONS, Field::SYMBOLIC_OPERATORS
Instance Attribute Summary collapse
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
Attributes included from Field
Instance Method Summary collapse
-
#initialize(operator, expression, space_between = true, options = nil) ⇒ PrefixExpression
constructor
A new instance of PrefixExpression.
- #simple? ⇒ Boolean
- #to_s ⇒ Object
Methods included from Field
#and, #as, #cast, #diff, #empty?, #matches, #ne, #neg, #not, #not_null?, #null?, #or
Constructor Details
#initialize(operator, expression, space_between = true, options = nil) ⇒ PrefixExpression
Returns a new instance of PrefixExpression.
10 11 12 13 14 |
# File 'lib/piglet/field/prefix_expression.rb', line 10 def initialize(operator, expression, space_between=true, =nil) ||= {} @operator, @expression, @space_between = operator, expression, space_between @type = [:type] || expression.type end |
Instance Attribute Details
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
8 9 10 |
# File 'lib/piglet/field/prefix_expression.rb', line 8 def operator @operator end |
Instance Method Details
#simple? ⇒ Boolean
16 17 18 |
# File 'lib/piglet/field/prefix_expression.rb', line 16 def simple? false end |
#to_s ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/piglet/field/prefix_expression.rb', line 20 def to_s if @space_between "#{@operator} #{parenthesise(@expression)}" else "#{@operator}#{parenthesise(@expression)}" end end |