Class: AlgebraDB::Build::Between
- Inherits:
-
Struct
- Object
- Struct
- AlgebraDB::Build::Between
- Defined in:
- lib/algebra_db/build/between.rb
Overview
A BETWEEN expression builder.
Constant Summary collapse
- VALID_TYPES =
%i[between not_between between_symmetric not_between_symmetric].freeze
Instance Attribute Summary collapse
-
#between_type ⇒ Object
Returns the value of attribute between_type.
-
#choose ⇒ Object
Returns the value of attribute choose.
-
#finish ⇒ Object
Returns the value of attribute finish.
-
#start ⇒ Object
Returns the value of attribute start.
Instance Method Summary collapse
-
#initialize(between_type, choose, start, finish) ⇒ Between
constructor
A new instance of Between.
- #render_syntax(builder) ⇒ Object
Constructor Details
#initialize(between_type, choose, start, finish) ⇒ Between
Returns a new instance of Between.
8 9 10 11 12 13 14 |
# File 'lib/algebra_db/build/between.rb', line 8 def initialize(between_type, choose, start, finish) super(between_type, choose, start, finish) return if VALID_TYPES.include?(between_type) raise ArgumentError, "#{between_type} must be one of #{VALID_TYPES.inspect}" end |
Instance Attribute Details
#between_type ⇒ Object
Returns the value of attribute between_type
5 6 7 |
# File 'lib/algebra_db/build/between.rb', line 5 def between_type @between_type end |
#choose ⇒ Object
Returns the value of attribute choose
5 6 7 |
# File 'lib/algebra_db/build/between.rb', line 5 def choose @choose end |
#finish ⇒ Object
Returns the value of attribute finish
5 6 7 |
# File 'lib/algebra_db/build/between.rb', line 5 def finish @finish end |
#start ⇒ Object
Returns the value of attribute start
5 6 7 |
# File 'lib/algebra_db/build/between.rb', line 5 def start @start end |
Instance Method Details
#render_syntax(builder) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/algebra_db/build/between.rb', line 16 def render_syntax(builder) choose.render_syntax(builder) builder.text(between_type.to_s.gsub('_', ' ').upcase) start.render_syntax(builder) builder.text('AND') finish.render_syntax(builder) end |