Module: Moon::Utility::Template

Defined in:
lib/moon/utility/template.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/moon/utility/template.rb', line 4

def self.extended(base)
  base.class_eval do

    def self.template(*class_attributes)
      @class_attributes = class_attributes
      self.class.send :attr_accessor, *@class_attributes
    end

    def self.[](*values)
      klass = self.dup
      (@class_attributes || [ ]).each do |class_attribute|
        klass.send :"#{class_attribute}=", values.shift
      end
      klass
    end

  end
end