Sha256: d5c382e7e5a22021c4f60daca1f19db63015ffa776333847c199c3d353e77aa4

Contents?: true

Size: 897 Bytes

Versions: 15

Compression:

Stored size: 897 Bytes

Contents

module Blender::Manifest::Mixer
  # mixes recipe module
  #
  # The purpose is to make the mixing of recipes cleaner and easier on the eyes :)
  # i.e. instead of
  #     require 'foo'
  #     include Blender::Recipes::Foo
  #     require 'bar'
  #     include Blender::Recipes::Bar
  # you can just
  #     mix :foo, :bar
  # @param [[String, Symbol, Module]] recipes to mix
  def mix(*recipes)

    recipes.each do |recipe|

      next if Root.mixed_recipes.include?(recipe)
      Root.mixed_recipes << recipe

      case recipe
      when String, Symbol
        require recipe.to_s
        mixin = "Blender::Recipes::#{recipe.to_s.camelize}".constantize
      when Module
        mixin = recipe
      else
        raise "Expecting String, Symbol or Module. don't know what do do with #{recipe.inspect}"
      end

      puts "MIX: #{mixin}"
      ::Root.send :include, mixin
    end
  end

end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
server-blender-manifest-0.0.18 lib/blender/manifest/mixer.rb
server-blender-manifest-0.0.17 lib/blender/manifest/mixer.rb
server-blender-manifest-0.0.16 lib/blender/manifest/mixer.rb
server-blender-manifest-0.0.15 lib/blender/manifest/mixer.rb
server-blender-0.0.13 vendor/server-blender-manifests/lib/blender/manifest/mixer.rb
server-blender-manifest-0.0.14 lib/blender/manifest/mixer.rb
server-blender-manifest-0.0.13 lib/blender/manifest/mixer.rb
server-blender-0.0.12 vendor/server-blender-manifests/lib/blender/manifest/mixer.rb
server-blender-manifest-0.0.12 lib/blender/manifest/mixer.rb
server-blender-0.0.11 vendor/server-blender-manifests/lib/blender/manifest/mixer.rb
server-blender-manifest-0.0.11 lib/blender/manifest/mixer.rb
server-blender-0.0.10 vendor/server-blender-manifests/lib/blender/manifest/mixer.rb
server-blender-manifest-0.0.9 lib/blender/manifest/mixer.rb
server-blender-0.0.8 vendor/server-blender-manifests/lib/blender/manifest/mixer.rb
server-blender-manifest-0.0.8 lib/blender/manifest/mixer.rb