Class: Piglet::Field::SuffixExpression

Inherits:
Object
  • Object
show all
Includes:
Field
Defined in:
lib/piglet/field/suffix_expression.rb

Overview

:nodoc:

Constant Summary

Constants included from Field

Field::FUNCTIONS, Field::SYMBOLIC_OPERATORS

Instance Attribute Summary

Attributes included from Field

#name, #type

Instance Method Summary collapse

Methods included from Field

#and, #as, #cast, #diff, #empty?, #matches, #ne, #neg, #not, #not_null?, #null?, #or

Constructor Details

#initialize(operator, expression, options = nil) ⇒ SuffixExpression

Returns a new instance of SuffixExpression.



8
9
10
11
12
# File 'lib/piglet/field/suffix_expression.rb', line 8

def initialize(operator, expression, options=nil)
  options ||= {}
  @operator, @expression = operator, expression
  @type = options[:type] || expression.type
end

Instance Method Details

#simple?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/piglet/field/suffix_expression.rb', line 14

def simple?
  false
end

#to_sObject



18
19
20
# File 'lib/piglet/field/suffix_expression.rb', line 18

def to_s
  "#{parenthesise(@expression)} #{@operator}"
end