Sha256: 114508a7baf482c10ebdcab1b7756721fff97e7a64e46fdce464903d32a31cce

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

Contents

module FilterParam
  module AST
    module Literals
      class String < Literal
        def initialize(value)
          @value = value.to_s
        end

        def data_type
          :string
        end

        private

        def to_boolean
          return Literals::Boolean::TRUE if value.downcase == "true"

          Literals::Boolean::FALSE
        end

        def to_string
          self
        end

        def to_integer
          Literals::Integer.new(value)
        end

        def to_decimal
          Literals::Decimal.new(value)
        end

        def to_date
          Literals::Date.new(value)
        end

        def to_datetime
          Literals::DateTime.new(value)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
filter_param-0.1.2 lib/filter_param/ast/literals/string.rb