Sha256: ffed1bf087d82d394500c3676fac112bff9febce403a1d7cdbacd03478b7f2a9
Contents?: true
Size: 816 Bytes
Versions: 1
Compression:
Stored size: 816 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 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.11 | app/models/styleus/view_component.rb |