Class: Alf::Sql::Processor::Clip
- Inherits:
-
Alf::Sql::Processor
- Object
- Sexpr::Rewriter
- Alf::Sql::Processor
- Alf::Sql::Processor::Clip
- Defined in:
- lib/alf/sql/processor/clip.rb
Constant Summary
Constants inherited from Alf::Sql::Processor
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#on_empty ⇒ Object
readonly
Returns the value of attribute on_empty.
Attributes inherited from Alf::Sql::Processor
Instance Method Summary collapse
-
#initialize(attributes, on_empty = :is_table_dee, builder) ⇒ Clip
constructor
A new instance of Clip.
- #on_select_exp(sexpr) ⇒ Object
- #on_select_list(sexpr) ⇒ Object
Methods inherited from Alf::Sql::Processor
#on_set_operator, #on_with_exp
Constructor Details
#initialize(attributes, on_empty = :is_table_dee, builder) ⇒ Clip
Returns a new instance of Clip.
6 7 8 9 10 |
# File 'lib/alf/sql/processor/clip.rb', line 6 def initialize(attributes, on_empty = :is_table_dee, builder) super(builder) @attributes = attributes @on_empty = on_empty end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/alf/sql/processor/clip.rb', line 11 def attributes @attributes end |
#on_empty ⇒ Object (readonly)
Returns the value of attribute on_empty.
11 12 13 |
# File 'lib/alf/sql/processor/clip.rb', line 11 def on_empty @on_empty end |
Instance Method Details
#on_select_exp(sexpr) ⇒ Object
13 14 15 16 |
# File 'lib/alf/sql/processor/clip.rb', line 13 def on_select_exp(sexpr) catch(:empty){ return super(sexpr) } send("select_#{on_empty}", sexpr) end |
#on_select_list(sexpr) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/alf/sql/processor/clip.rb', line 18 def on_select_list(sexpr) result = sexpr.select{|child| (child == :select_list) or attributes.include?(child.as_name.to_sym) } (result.size==1) ? throw(:empty) : result end |