Class: Weaver::Column
- Inherits:
-
Object
- Object
- Weaver::Column
- Defined in:
- lib/weaver/element_types/row.rb
Overview
Column element
Instance Attribute Summary collapse
-
#elem ⇒ Object
readonly
Returns the value of attribute elem.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #colsize(size) ⇒ Object
- #generate ⇒ Object
-
#initialize(width, page, anchors, options = {}, &block) ⇒ Column
constructor
A new instance of Column.
- #style(size) ⇒ Object
Constructor Details
#initialize(width, page, anchors, options = {}, &block) ⇒ Column
Returns a new instance of Column.
33 34 35 36 37 38 |
# File 'lib/weaver/element_types/row.rb', line 33 def initialize(width, page, anchors, = {}, &block) @width = width = @elem = Elements.new(page, anchors) @elem.instance_eval(&block) end |
Instance Attribute Details
#elem ⇒ Object (readonly)
Returns the value of attribute elem.
31 32 33 |
# File 'lib/weaver/element_types/row.rb', line 31 def elem @elem end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
31 32 33 |
# File 'lib/weaver/element_types/row.rb', line 31 def end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
31 32 33 |
# File 'lib/weaver/element_types/row.rb', line 31 def width @width end |
Instance Method Details
#colsize(size) ⇒ Object
40 41 42 |
# File 'lib/weaver/element_types/row.rb', line 40 def colsize(size) [size] || width end |
#generate ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/weaver/element_types/row.rb', line 50 def generate styles = i[xs sm md lg].map { |size| style(size) }.join(' ') " <div class=\"\#{styles}\">\n\#{elem.generate}\n </div>\n ENDCOLUMN\nend\n" |
#style(size) ⇒ Object
44 45 46 47 48 |
# File 'lib/weaver/element_types/row.rb', line 44 def style(size) return "hidden-#{size} " if colsize(size).zero? "col-#{size}-#{colsize(size)}" end |