Class: Cyrel::Clause::Limit
Overview
Represents a LIMIT clause in a Cypher query.
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
Instance Method Summary collapse
-
#initialize(amount) ⇒ Limit
constructor
Initializes a LIMIT clause.
-
#render(query) ⇒ String
Renders the LIMIT clause.
-
#replace!(other_limit) ⇒ Object
Merging LIMIT typically replaces the existing value.
Constructor Details
#initialize(amount) ⇒ Limit
Initializes a LIMIT clause.
13 14 15 16 |
# File 'lib/cyrel/clause/limit.rb', line 13 def initialize(amount) @amount = Expression.coerce(amount) # Could add validation here. end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
7 8 9 |
# File 'lib/cyrel/clause/limit.rb', line 7 def amount @amount end |
Instance Method Details
#render(query) ⇒ String
Renders the LIMIT clause.
21 22 23 |
# File 'lib/cyrel/clause/limit.rb', line 21 def render(query) "LIMIT #{@amount.render(query)}" end |
#replace!(other_limit) ⇒ Object
Merging LIMIT typically replaces the existing value.
27 28 29 30 |
# File 'lib/cyrel/clause/limit.rb', line 27 def replace!(other_limit) @amount = other_limit.amount self end |