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 =
"("
PAREN_RIGHT =
")"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Range.



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

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

Instance Attribute Details

#boundsObject

Returns the value of attribute bounds

Returns:

  • (Object)

    the current value of bounds



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

def bounds
  @bounds
end

#lowerObject

Returns the value of attribute lower

Returns:

  • (Object)

    the current value of lower



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

def lower
  @lower
end

#upperObject

Returns the value of attribute upper

Returns:

  • (Object)

    the current value of upper



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

def upper
  @upper
end

Instance Method Details

#exclude_begin?Boolean

Returns:

  • (Boolean)


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

def exclude_begin?
  bounds[0] == PAREN_LEFT
end

#exclude_end?Boolean

Returns:

  • (Boolean)


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

def exclude_end?
  bounds[1] == PAREN_RIGHT
end