Class: ActiveRecord::Refined::AST::Case::Pending
- Defined in:
- lib/active_record/refined/ast.rb
Overview
What a when is until its then arrives. A Node so that using it
as one says what is missing rather than reaching ActiveRecord as
something it cannot read.
Instance Method Summary collapse
-
#initialize(kase, condition) ⇒ Pending
constructor
A new instance of Pending.
- #then(value = nil, &block) ⇒ Object
- #to_arel(_table, _model) ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(kase, condition) ⇒ Pending
Returns a new instance of Pending.
443 444 445 446 |
# File 'lib/active_record/refined/ast.rb', line 443 def initialize(kase, condition) @kase = kase @condition = condition end |
Instance Method Details
#then(value = nil, &block) ⇒ Object
448 449 450 451 452 |
# File 'lib/active_record/refined/ast.rb', line 448 def then(value = nil, &block) Case.new(@kase.operand, @kase.whens + [[@condition, Case.argument(:then, value, block)]], @kase.default) end |
#to_arel(_table, _model) ⇒ Object
454 455 456 |
# File 'lib/active_record/refined/ast.rb', line 454 def to_arel(_table, _model) raise ArgumentError, "when needs a matching then" end |