Class: ROM::SQL::Postgres::Values::Range

Inherits:
Struct
  • Object
show all
Defined in:
lib/rom/sql/extensions/postgres/types/range.rb

Constant Summary collapse

PAREN_LEFT =
'('.freeze
PAREN_RIGHT =
')'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lower, upper, bounds = :'[)') ⇒ Range

Returns a new instance of Range.



13
14
15
# File 'lib/rom/sql/extensions/postgres/types/range.rb', line 13

def initialize(lower, upper, bounds = :'[)')
  super
end

Instance Attribute Details

#boundsObject

Returns the value of attribute bounds

Returns:

  • (Object)

    the current value of bounds



9
10
11
# File 'lib/rom/sql/extensions/postgres/types/range.rb', line 9

def bounds
  @bounds
end

#lowerObject

Returns the value of attribute lower

Returns:

  • (Object)

    the current value of lower



9
10
11
# File 'lib/rom/sql/extensions/postgres/types/range.rb', line 9

def lower
  @lower
end

#upperObject

Returns the value of attribute upper

Returns:

  • (Object)

    the current value of upper



9
10
11
# File 'lib/rom/sql/extensions/postgres/types/range.rb', line 9

def upper
  @upper
end

Instance Method Details

#exclude_begin?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/rom/sql/extensions/postgres/types/range.rb', line 17

def exclude_begin?
  bounds[0] == PAREN_LEFT
end

#exclude_end?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/rom/sql/extensions/postgres/types/range.rb', line 21

def exclude_end?
  bounds[1] == PAREN_RIGHT
end