Sha256: b90d4c5ea8c327cc56469719253aac3dd92f30d7a0790f47348281a7a51d643b
Contents?: true
Size: 555 Bytes
Versions: 3
Compression:
Stored size: 555 Bytes
Contents
# Models a Rails model. require 'katapult/element' require 'katapult/attribute' require 'generators/katapult/model/model_generator' module Katapult class Model < Element UnknownAttributeError = Class.new(StandardError) attr_accessor :attrs def initialize(*args) self.attrs = [] super end def attr(attr_name, options = {}) attrs << Attribute.new(attr_name, options) end def label_attr attrs.first end def render Generators::ModelGenerator.new(self).invoke_all end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
katapult-0.1.2 | lib/katapult/model.rb |
katapult-0.1.1 | lib/katapult/model.rb |
katapult-0.1.0 | lib/katapult/model.rb |