Sha256: 70bfb9f5699e35870b4073ab386cf10a414e052ebf2714172562b9d7ad2985ab

Contents?: true

Size: 427 Bytes

Versions: 9

Compression:

Stored size: 427 Bytes

Contents

module Yaks
  module Configurable
    def self.included(descendant)
      descendant.instance_eval do
        extend ClassMethods
      end
    end

    module ClassMethods
      def config_method(name, options)
        define_method name do |*args, &block|
          append_to(
            options.fetch(:append_to),
            options.fetch(:create).create(*args, &block)
          )
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
yaks-0.7.5 lib/yaks/configurable.rb
yaks-0.7.4 lib/yaks/configurable.rb
yaks-0.7.3 lib/yaks/configurable.rb
yaks-0.7.2 lib/yaks/configurable.rb
yaks-0.7.1 lib/yaks/configurable.rb
yaks-0.7.0 lib/yaks/configurable.rb
yaks-0.6.2 lib/yaks/configurable.rb
yaks-0.6.1 lib/yaks/configurable.rb
yaks-0.6.0 lib/yaks/configurable.rb