Sha256: 39f2075f04b714e4321aa8034d8361582be9d69a69d5cc78f859ec549f227891

Contents?: true

Size: 1.54 KB

Versions: 6

Compression:

Stored size: 1.54 KB

Contents

module RailsAssist::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}Permit < Permit::Base"
    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 RailsAssist::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

6 entries across 6 versions & 1 rubygems

Version Path
rails_artifactor-0.5.0 lib/rails_artifactor/artifact/markers.rb
rails_artifactor-0.4.0 lib/rails_artifactor/artifact/markers.rb
rails_artifactor-0.3.6 lib/rails_artifactor/artifact/markers.rb
rails_artifactor-0.3.5 lib/rails_artifactor/artifact/markers.rb
rails_artifactor-0.3.4 lib/rails_artifactor/artifact/markers.rb
rails_artifactor-0.3.3 lib/rails_artifactor/artifact/markers.rb