Class: PGB::Keyword

Inherits:
Expression show all
Defined in:
lib/pgb/keyword.rb

Constant Summary collapse

SUPPORTED_VALUES =
%w[TRUE FALSE NULL].freeze

Instance Method Summary collapse

Methods included from SQLDisplayable

#inspect, #to_s

Constructor Details

#initialize(value) ⇒ Keyword

Returns a new instance of Keyword.



7
8
9
10
11
12
13
# File 'lib/pgb/keyword.rb', line 7

def initialize(value)
  if SUPPORTED_VALUES.include?(normalized(value))
    @value = normalized(value)
  else
    raise Error, "Unsupported keyword: #{value.inspect}"
  end
end

Instance Method Details

#to_sqlObject



15
16
17
# File 'lib/pgb/keyword.rb', line 15

def to_sql
  value
end