lib/stasis/scope/action.rb in stasis-0.1.9 vs lib/stasis/scope/action.rb in stasis-0.1.10

- old
+ new

@@ -10,11 +10,21 @@ attr_accessor :_layout # `String` -- If present, render this path instead of the default. attr_accessor :_render - def initialize(stasis) + # `Hash` -- Parameters to be made available to the scope, usually through + # `Stasis::Server`. + attr_accessor :params + + def initialize(stasis, options={}) @_stasis = stasis + @params = options[:params] || {} + + @params = @params.inject({}) do |options, (key, value)| + options[(key.to_sym rescue key) || key] = value + options + end # Some plugins define methods to be made available to action scopes. This call # binds those methods. @_stasis.plugins.each do |plugin| _bind_plugin(plugin, :action_method) \ No newline at end of file