Class: BB::Component
- Inherits:
-
Object
- Object
- BB::Component
- Defined in:
- lib/b_b/component.rb
Constant Summary collapse
- TEMPLATE =
{ cross_join: "CROSS JOIN %s AS %s", from: "FROM %s", from_union_all_with_alias: "FROM (SELECT * FROM %s) AS %s", from_with_alias: "FROM %s AS %s", full_outer_join_each: "FULL OUTER JOIN EACH %s AS %s ON %s", group: "GROUP BY %s", group_each: "GROUP EACH BY %s", having: "HAVING %s", inner_join: "INNER JOIN %s AS %s ON %s", inner_join_each: "INNER JOIN EACH %s AS %s ON %s", join: "JOIN %s AS %s ON %s", join_each: "JOIN EACH %s AS %s ON %s", left_join: "LEFT JOIN %s AS %s ON %s", left_join_each: "LEFT JOIN EACH %s AS %s ON %s", left_outer_join: "LEFT OUTER JOIN %s AS %s ON %s", left_outer_join_each: "LEFT OUTER JOIN EACH %s AS %s ON %s", limit: "LIMIT %d", limit_with_offset: "LIMIT %d OFFSET %d", omit_record_if: "OMIT RECORD IF %s", order: "ORDER BY %s", right_join: "RIGHT JOIN EACH %s AS %s ON %s", right_join_each: "RIGHT JOIN EACH %s AS %s ON %s", right_outer_join: "RIGHT OUTER JOIN EACH %s AS %s ON %s", right_outer_join_each: "RIGHT OUTER JOIN EACH %s AS %s ON %s", select: "SELECT %s", where: "WHERE %s" }.freeze
Instance Attribute Summary collapse
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize ⇒ Component
Returns a new instance of Component.
34 35 36 37 |
# File 'lib/b_b/component.rb', line 34 def initialize @filters = [] @options = {} end |
Instance Attribute Details
#filters ⇒ Object
Returns the value of attribute filters.
32 33 34 |
# File 'lib/b_b/component.rb', line 32 def filters @filters end |
#options ⇒ Object
Returns the value of attribute options.
32 33 34 |
# File 'lib/b_b/component.rb', line 32 def @options end |
#type ⇒ Object
Returns the value of attribute type.
32 33 34 |
# File 'lib/b_b/component.rb', line 32 def type @type end |
Instance Method Details
#build ⇒ Object
39 40 41 |
# File 'lib/b_b/component.rb', line 39 def build type && send("to_#{type}") end |