Sha256: 313927a56fdd3c75750d0bf69364280c83c2cb3884a0e029a5fad7f0b1eb7732

Contents?: true

Size: 1.41 KB

Versions: 14

Compression:

Stored size: 1.41 KB

Contents

module Rails3::Assist
  module BaseHelper
    def self.included(base)
      base.extend ClassMethods
      base.class_eval do
        include Rails3::Assist::App
        include ::Thor::Actions
      end
    end

    module ClassMethods
      def multi_aliases_for name
        multi_alias :_after_ => name, :create => :new, :insert_into => [:inject_into, :update], :read => :X_content, :remove => :delete                    
      end
    end
                 
    protected

    def get_type options = {}
      case options
      when Hash
        raise ArgumentError, "No artifact type specified #{options}" if !options[:type]
        options[:type].to_sym
      when String, Symbol
        options.to_sym
      else
        raise ArgumentError, "Bad artifact type specified #{options}"        
      end
    end
    
    def debug?      
      Rails3::Assist.debug_on
    end    

    def debug msg
      puts msg if debug?
    end

    def set options, type
      options.merge!(:type => type)
      options
    end

    def orm_notify
      ''
    end

    def marker_option name, options={}      
      type = last_option(options)[:type]
      marker_content = if type
        method = :"#{type}_marker"
        orm_marker = send method, name, options if respond_to? method 
      else
        name.to_s.camelize
      end 
      options[:before] ? {:before => marker_content} : {:after => marker_content}      
    end
  end
end   

Version data entries

14 entries across 14 versions & 1 rubygems

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