Class: Weaver::Row

Inherits:
Elements show all
Defined in:
lib/weaver/element_types/row.rb

Overview

Row element

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Elements

#_button, #accordion, #background, #badge, #big_button, #big_embossed_button, #block_button, #breadcrumb, #center, #circle_button, #crossfade_image, #embossed_button, #gallery, #half, #hyperlink, #ibox, #icon, #image, #jumbotron, #math, #method_missing, #modal, #normal_button, #on_page_load, #outline_button, #p, #panel, #quarter, #request_css, #request_js, #root, #rounded_button, #row, #small_button, #syntax, #table, #table_from_hashes, #table_from_source, #tabs, #text, #third, #tiny_button, #twothirds, #wform, #widget, #write_script_once

Constructor Details

#initialize(page, anchors, options) ⇒ Row

Returns a new instance of Row.



8
9
10
11
12
13
14
15
# File 'lib/weaver/element_types/row.rb', line 8

def initialize(page, anchors, options)
  @columns = []
  @free = 12
  @extra_classes = options[:class] || ''
  @style = options[:style]
  @anchors = anchors
  @page = page
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Weaver::Elements

Instance Attribute Details

#extra_classesObject

Returns the value of attribute extra_classes.



6
7
8
# File 'lib/weaver/element_types/row.rb', line 6

def extra_classes
  @extra_classes
end

#styleObject

Returns the value of attribute style.



6
7
8
# File 'lib/weaver/element_types/row.rb', line 6

def style
  @style
end

Instance Method Details

#col(occupies, options = {}, &block) ⇒ Object



17
18
19
20
21
22
# File 'lib/weaver/element_types/row.rb', line 17

def col(occupies, options = {}, &block)
  raise 'Not enough columns!' if @free < occupies

  @columns << Column.new(occupies, @page, @anchors, options, &block)
  @free -= occupies
end

#generateObject



24
25
26
# File 'lib/weaver/element_types/row.rb', line 24

def generate
  @columns.map(&:generate).join
end