Class: Motion::Layout
- Inherits:
-
Object
- Object
- Motion::Layout
- Defined in:
- lib/motion-layout/layout.rb,
lib/motion-layout/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
- #horizontal(horizontal) ⇒ Object
-
#initialize {|_self| ... } ⇒ Layout
constructor
A new instance of Layout.
- #metrics(metrics) ⇒ Object
- #subviews(subviews) ⇒ Object
- #vertical(vertical) ⇒ Object
- #view(view) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Layout
Returns a new instance of Layout.
3 4 5 6 7 8 9 10 |
# File 'lib/motion-layout/layout.rb', line 3 def initialize(&block) @verticals = [] @horizontals = [] @metrics = {} yield self strain end |
Instance Method Details
#horizontal(horizontal) ⇒ Object
24 25 26 |
# File 'lib/motion-layout/layout.rb', line 24 def horizontal(horizontal) @horizontals << horizontal end |
#metrics(metrics) ⇒ Object
12 13 14 |
# File 'lib/motion-layout/layout.rb', line 12 def metrics(metrics) @metrics = Hash[metrics.keys.map(&:to_s).zip(metrics.values)] end |
#subviews(subviews) ⇒ Object
16 17 18 |
# File 'lib/motion-layout/layout.rb', line 16 def subviews(subviews) @subviews = Hash[subviews.keys.map(&:to_s).zip(subviews.values)] end |
#vertical(vertical) ⇒ Object
28 29 30 |
# File 'lib/motion-layout/layout.rb', line 28 def vertical(vertical) @verticals << vertical end |
#view(view) ⇒ Object
20 21 22 |
# File 'lib/motion-layout/layout.rb', line 20 def view(view) @view = view end |