Sha256: 8dc443b68af1b42e3044ebc73e1add612a459f240a0506839c0841009835a87a

Contents?: true

Size: 1.23 KB

Versions: 16

Compression:

Stored size: 1.23 KB

Contents

module Rails3::Assist
  module Orm
    module Base
      def self.included base
        base.class_eval do
          include Rails3::Assist::Artifact::Model
        end
      end

      protected

      def orm_marker_name name, options = {:model_type => :document}
        document_name options
      end

      def document_name options = {:model_type => :document} 
        type_content = options[:model_type] == :embedded ?  "#{orm_name}::EmbeddedDocument" : "#{orm_name}::Document"
      end

      def clazz name
        "class #{name.to_s.camelize}"
      end

      def file name, include_stmt, &block
        %Q{#{clazz name}
  #{include_stmt}
  #{yield if block}
end}
      end

      def file_w_include name, module_name, &block
        file name, "include #{module_name}", &block 
      end

      def simple_file name, module_name, &block
        %Q{#{clazz name}
  #{yield if block}
end}
      end

      def file_w_inherit name, module_name, &block
        %Q{#{clazz name} < #{module_name}
  #{yield if block}
end}
      end 
      
      def field name, type = nil
        return "#{field_name} :#{name}, #{type}" if type
        "#{field_name} :#{name}"
      end      
    end
  end
end
              
require_all File.dirname(__FILE__) + '/orm'

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rails3_artifactor-0.4.0 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.3.2 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.3.1 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.3.0 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.2.8 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.2.7 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.2.6 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.2.5 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.2.4 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.2.3 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.2.2 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.2.1 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.1.5 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.1.4 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.1.3 lib/rails3_artifactor/artifact/orm.rb
rails3_artifactor-0.1.2 lib/rails3_artifactor/artifact/orm.rb