Class: Lhm::Intersection
- Inherits:
-
Object
- Object
- Lhm::Intersection
- Defined in:
- lib/lhm/intersection.rb
Overview
Determine and format columns common to origin and destination.
Instance Method Summary collapse
- #common ⇒ Object
- #escaped ⇒ Object
-
#initialize(origin, destination) ⇒ Intersection
constructor
A new instance of Intersection.
- #joined ⇒ Object
- #typed(type) ⇒ Object
Constructor Details
#initialize(origin, destination) ⇒ Intersection
Returns a new instance of Intersection.
7 8 9 10 |
# File 'lib/lhm/intersection.rb', line 7 def initialize(origin, destination) @origin = origin @destination = destination end |
Instance Method Details
#common ⇒ Object
12 13 14 |
# File 'lib/lhm/intersection.rb', line 12 def common (@origin.columns.keys & @destination.columns.keys).sort end |
#escaped ⇒ Object
16 17 18 |
# File 'lib/lhm/intersection.rb', line 16 def escaped common.map { |name| tick(name) } end |
#joined ⇒ Object
20 21 22 |
# File 'lib/lhm/intersection.rb', line 20 def joined escaped.join(", ") end |
#typed(type) ⇒ Object
24 25 26 |
# File 'lib/lhm/intersection.rb', line 24 def typed(type) common.map { |name| qualified(name, type) }.join(", ") end |