Module: Rafters::Component::ClassMethods

Defined in:
lib/rafters/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_attributesObject

Returns the value of attribute _attributes.



91
92
93
# File 'lib/rafters/component.rb', line 91

def _attributes
  @_attributes
end

#_defaultsObject

Returns the value of attribute _defaults.



91
92
93
# File 'lib/rafters/component.rb', line 91

def _defaults
  @_defaults
end

#_template_nameObject

Returns the value of attribute _template_name.



91
92
93
# File 'lib/rafters/component.rb', line 91

def _template_name
  @_template_name
end

Instance Method Details

#attribute(name) ⇒ Object



93
94
95
96
# File 'lib/rafters/component.rb', line 93

def attribute(name)
  self._attributes ||= []
  self._attributes << name
end

#attributes(*names) ⇒ Object



98
99
100
# File 'lib/rafters/component.rb', line 98

def attributes(*names)
  names.each { |name| attribute(name) }
end

#default(name, value) ⇒ Object



102
103
104
105
# File 'lib/rafters/component.rb', line 102

def default(name, value)
  self._defaults ||= {}
  self._defaults[name] = value
end

#defaults(settings = {}) ⇒ Object



107
108
109
# File 'lib/rafters/component.rb', line 107

def defaults(settings = {})
  settings.each { |name, value| default(name, value) }
end

#template_name(name) ⇒ Object



111
112
113
# File 'lib/rafters/component.rb', line 111

def template_name(name)
  self._template_name = name.to_s
end