Class: Rack::ScriptStackerUtils::SpecSolidifier
- Inherits:
- BasicObject
- Defined in:
- lib/rack/scriptstacker.rb
Instance Method Summary collapse
- #call(stack_spec) ⇒ Object
-
#initialize(stacker_names) ⇒ SpecSolidifier
constructor
A new instance of SpecSolidifier.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(stacker_names) ⇒ SpecSolidifier
Returns a new instance of SpecSolidifier.
74 75 76 77 |
# File 'lib/rack/scriptstacker.rb', line 74 def initialize stacker_names @stacker_names = stacker_names @specs = ::Hash.new { |hash, key| hash[key] = [] } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/rack/scriptstacker.rb', line 84 def method_missing name, *args if !@stacker_names.include? name ::Kernel.raise ::ArgumentError.new( "Expected one of #{@stacker_names}, but got #{name.inspect}." ) end if args.size != 1 ::Kernel.raise ::ArgumentError.new( "Expected a path spec like 'static/css' => 'stylesheets', " + "but got #{args.inspect} instead." ) end @specs[name].push ::Rack::ScriptStackerUtils::PathSpec.new(args[0]) end |
Instance Method Details
#call(stack_spec) ⇒ Object
79 80 81 82 |
# File 'lib/rack/scriptstacker.rb', line 79 def call stack_spec instance_eval &stack_spec @specs end |