Sha256: 15a3556620130770cfd7668566ac7b71c44b65c828a6dcc8da15dec5cc128280
Contents?: true
Size: 760 Bytes
Versions: 22
Compression:
Stored size: 760 Bytes
Contents
class Card class Bootstrap module ComponentLoader def load_components components.each do |component| require_relative "component/#{component}" include_component component end end def include_component component component_class = to_const component.camelcase define_method component do |*args, &block| component_class.render self, *args, &block end end def components path = File.expand_path "component/*.rb", __dir__ Dir.glob(path).map do |file| File.basename file, ".rb" end end def to_const name self.class.const_get "::Card::Bootstrap::Component::#{name.camelcase}" end end end end
Version data entries
22 entries across 22 versions & 1 rubygems