Sha256: 8fc1701020b97818f5a5481c49288708198e21ab76fe6063a2e2ca9c75023bb3

Contents?: true

Size: 1.52 KB

Versions: 7

Compression:

Stored size: 1.52 KB

Contents

module Rails3::Assist::Artifact
  module Marker
    def marker name, type, options=nil
      method = "#{type}_marker"  
      raise "No such marker method in this context: #{self}, ##{method}" if !respond_to? method
      send method, name, options 
    end
  end
  
  module Controller
    def controller_marker name, options=nil
      "#{name.to_s.camelize}Controller < ActionController::Base"
    end
    
    extend self
  end

  module Helper   
    def helper_marker name, options=nil
      "#{name.to_s.camelize}Helper"
    end

    extend self
  end

  module Permit
    def permit_marker name, options=nil
      "#{name.to_s.camelize}"
    end        
    
    extend self    
  end
  
  module Mailer
    def mailer_marker name, options=nil
      "#{name.to_s.camelize}Mailer < ActionMailer::Base"
    end
    
    extend self    
  end    

  module Observer
    def observer_marker name, options=nil
      "#{name.to_s.camelize}Observer < ActiveRecord::Observer"
    end
    
    extend self
  end

  module Migration
    def migration_marker name, options=nil
      "#{name.to_s.camelize} < ActiveRecord::Migration"
    end    
    
    extend self
  end
  
  module Model   
    include Rails3::Assist::BaseHelper    
    
    def model_marker name, options={}
      return send :orm_marker_name, name, options if respond_to?(:orm_marker_name)
      name.to_s.camelize      
    end
    
    def orm_notify
      ". You must specify an ORM with the macro use_orm, f.ex -- use_orm :active_record"
    end 
    
    extend self       
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails3_artifactor-0.2.3 lib/rails3_artifactor/artifact/markers.rb
rails3_artifactor-0.2.2 lib/rails3_artifactor/artifact/markers.rb
rails3_artifactor-0.2.1 lib/rails3_artifactor/artifact/markers.rb
rails3_artifactor-0.1.5 lib/rails3_artifactor/artifact/markers.rb
rails3_artifactor-0.1.4 lib/rails3_artifactor/artifact/markers.rb
rails3_artifactor-0.1.3 lib/rails3_artifactor/artifact/markers.rb
rails3_artifactor-0.1.2 lib/rails3_artifactor/artifact/markers.rb