Class: Rusql::Join
- Inherits:
-
Object
- Object
- Rusql::Join
- Defined in:
- lib/rusql/join.rb
Constant Summary collapse
- TYPES =
%i( inner_join left_outer_join outer_join )
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, table, condition) ⇒ Join
constructor
A new instance of Join.
- #to_s ⇒ Object
Constructor Details
#initialize(type, table, condition) ⇒ Join
Returns a new instance of Join.
13 14 15 16 17 18 19 20 21 |
# File 'lib/rusql/join.rb', line 13 def initialize(type, table, condition) raise Exception.new("Expected type to be one of #{ TYPES.map(&:to_s).join(",") }") unless TYPES.include?(type) raise TypeException.new(Table, table.class) unless table.is_a?(Table) raise TypeException.new(BasicCondition, condition.class) unless condition.is_a?(BasicCondition) @type = type @table = table @condition = condition end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/rusql/join.rb', line 3 def type @type end |
Instance Method Details
#to_s ⇒ Object
23 24 25 |
# File 'lib/rusql/join.rb', line 23 def to_s "#{ self.type.to_s.upcase.gsub("_"," ") } #{self.table.to_s_for_aliasing} ON #{self.condition.to_s}" end |