Sha256: b7ae804e6d0343c55afbcd89b1fd978bdfbd6308758b35bd4121f4a739b61149
Contents?: true
Size: 1.29 KB
Versions: 5
Compression:
Stored size: 1.29 KB
Contents
capabilities = Dir.glob(File.join(File.dirname(__FILE__), 'capabilities', '*.rb')) capabilities.each {|capability| require capability} module ExpressTemplates # Components provide self-contained reusable view code meant to be shared # within a project or across many projects through a library of components # module Components # Components::Base is the base class for ExpressTemplates view components. # # class Base < Arbre::Component def self.builder_method_and_class(method_name, klass) Arbre::Element::BuilderMethods.class_eval <<-EOF, __FILE__, __LINE__ def #{method_name}(*args, &block) insert_tag ::#{klass.name}, *args, &block end EOF # puts "added #{method_name} -> #{klass.name}" end def self.emits(proc = nil, &block) define_method(:build, &(proc || block)) end def build(*args, block) raise "#build method must be overridden" end def resource helpers.resource end def self.inherited(subclass) builder_method_and_class subclass.to_s.demodulize.underscore, subclass end def indent_level parent_indent_level = parent.try(:indent_level) || 0 end def to_s children.to_s end end end end
Version data entries
5 entries across 5 versions & 2 rubygems