Class: Sirens::ColumnsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/components_builder/columns_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeColumnsBuilder

Initializing



5
6
7
8
9
# File 'lib/components_builder/columns_builder.rb', line 5

def initialize()
    @props = Hash[]
    @columns = []
    @popup_menu = nil
end

Instance Method Details

#column(props = ) ⇒ Object

List columns



53
54
55
# File 'lib/components_builder/columns_builder.rb', line 53

def column(props = Hash[])
    @columns << ColumnProps.new(props)
end

#columnsObject



11
12
13
# File 'lib/components_builder/columns_builder.rb', line 11

def columns()
    @columns
end

#get_popup_menuObject



15
16
17
# File 'lib/components_builder/columns_builder.rb', line 15

def get_popup_menu()
    @popup_menu
end

#handlers(props) ⇒ Object



47
48
49
# File 'lib/components_builder/columns_builder.rb', line 47

def handlers(props)
    @props.merge!(props)
end

#model(object) ⇒ Object

Current component model



33
34
35
# File 'lib/components_builder/columns_builder.rb', line 33

def model(object)
    @props[:model] = object
end

Popup menu



59
60
61
# File 'lib/components_builder/columns_builder.rb', line 59

def popup_menu(&block)
    @popup_menu = block
end

#props(props) ⇒ Object



43
44
45
# File 'lib/components_builder/columns_builder.rb', line 43

def props(props)
    @props.merge!(props)
end

#render(props, &block) ⇒ Object

Evaluating



21
22
23
24
25
26
27
28
29
# File 'lib/components_builder/columns_builder.rb', line 21

def render(props, &block)
    @props = props
    @columns = []
    @popup_menu = nil

    instance_exec(self, &block)

    self
end

#styles(props) ⇒ Object

Current component props



39
40
41
# File 'lib/components_builder/columns_builder.rb', line 39

def styles(props)
    @props.merge!(props)
end