Sha256: f1217952ca435b7e1ef497e57f6726764ad96ad3d14740204617c6dd4e6d047b
Contents?: true
Size: 872 Bytes
Versions: 1
Compression:
Stored size: 872 Bytes
Contents
module Styleus class ViewComponent < Styleus::Base with_attributes :headline, :partial_path, :helper # id is used as anchor id in the anchor menu, # so it has to be a uid. # TODO: make sure the uid-ness :) def id headline.underscore.gsub(/ /, '_') end def to_s headline.humanize.pluralize end class << self def components @components ||= [] end def from_hashes(hashes) components.clear hashes.each { |comp_hash| components << new(comp_hash) } components end def from_names(section, names) components.clear names.each do |name| components << new( headline: name.to_s.humanize, partial_path: File.join('components', section, "#{name}")) end components end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
styleus-0.0.12 | app/models/styleus/view_component.rb |