Sha256: 759fc3a37356a99de0cb1ff2dd44c923e7df19c529ddbe579f763b194947cf15

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

module CurlyMustache
  module Attributes
    class Definer
    
      def initialize(klass)
        @class = klass
      end
    
      def define(name, type, options = {})
        @class.check_attribute_type(type)
        definition = { :type => type }
        @class.attribute_definitions[name.to_sym] = definition
        @class.class_eval <<-END
          def #{name}
            read_attribute('#{name}')
          end
        
          def #{name}=(value)
            write_attribute('#{name}', value)
          end
        END
      end
    
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cjbottaro-curly_mustache-0.0.0 lib/attributes/definer.rb