Class: Css3buttons::ButtonGroup

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/css3buttons/button_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, options) ⇒ ButtonGroup

Returns a new instance of ButtonGroup.



6
7
8
9
10
11
# File 'lib/css3buttons/button_group.rb', line 6

def initialize(template, options)
  @button_count = 0
  @template = template
  @options = options
  @options[:wrapper_tag] ||= :div
end

Instance Attribute Details

#button_countObject (readonly)

Returns the value of attribute button_count.



4
5
6
# File 'lib/css3buttons/button_group.rb', line 4

def button_count
  @button_count
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/css3buttons/button_group.rb', line 4

def options
  @options
end

#templateObject (readonly)

Returns the value of attribute template.



4
5
6
# File 'lib/css3buttons/button_group.rb', line 4

def template
  @template
end

Instance Method Details

#render(&block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/css3buttons/button_group.rb', line 13

def render(&block)
  html_options = @options.clone
  html_options.delete(:wrapper_tag)
  html_options.delete(:minor)
  html_options[:class] ||= ''
  html_options[:class] = (html_options[:class].split(" ") + ['button-group']).join(" ")
  html_options[:class] = (html_options[:class].split(" ") + ['minor-group']).join(" ") if @options[:minor]
  (@options[:wrapper_tag], @template.capture(&block), html_options) if block_given?
end