Sha256: 3b7ea02852daa32ff88678829f223ce62ca007e434ce4c3970f089483665b257

Contents?: true

Size: 555 Bytes

Versions: 3

Compression:

Stored size: 555 Bytes

Contents

module Chap
  module SpecialMethods
    SPECIAL_METHODS = %w/deploy_to release_path current_path shared_path cached_path node chap log run/

    def self.included(base)
      base.send(:extend, ClassMethods)
      base.define_special_methods
    end

    module ClassMethods
      # delegate to the config class
      def define_special_methods
        SPECIAL_METHODS.each do |method|
          class_eval <<-EOL
            def #{method}(*args)
              @config.#{method}(*args)
            end
          EOL
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chap-0.0.3 lib/chap/special_methods.rb
chap-0.0.2 lib/chap/special_methods.rb
chap-0.0.1 lib/chap/special_methods.rb