Sha256: 5ebadb93f2a8b67f36abe3cf0219e9d96132bddce93b088381755ce5952bb7d7

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

# encoding: utf-8

module Piglet
  module Field
    class PrefixExpression # :nodoc:
      include Field
      
      attr_reader :operator
    
      def initialize(operator, expression, space_between=true, options=nil)
        options ||= {}
        @operator, @expression, @space_between = operator, expression, space_between
        @type = options[:type] || expression.type
        @predecessors = [expression]
      end
    
      def simple?
        false
      end
    
      def to_s(inner=false)
        expr = if inner then @expression.field_alias else @expression end
        
        if @space_between
          "#{@operator} #{parenthesise(expr)}"
        else
          "#{@operator}#{parenthesise(expr)}"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
piglet-0.3.0 lib/piglet/field/prefix_expression.rb