lib/volt/page/bindings/view_binding/controller_handler.rb in volt-0.9.1 vs lib/volt/page/bindings/view_binding/controller_handler.rb in volt-0.9.2
- old
+ new
@@ -5,11 +5,11 @@
def initialize(controller, action)
@controller = controller
@action = action.to_sym if action
end
- def call_action(stage_prefix=nil, stage_suffix=nil)
+ def call_action(stage_prefix = nil, stage_suffix = nil)
return unless @action
has_stage = stage_prefix || stage_suffix
if has_stage
@@ -29,23 +29,21 @@
# stop_chain was called
return true
end
end
- if @controller.respond_to?(method_name)
- @controller.send(method_name)
- end
+ @controller.send(method_name) if @controller.respond_to?(method_name)
@controller.run_actions(:after, @action) unless has_stage
# before_action chain was not stopped
- return false
+ false
end
# Fetch the controller class
def self.get_controller_and_action(controller_path)
- raise "Invalid controller path: #{controller_path.inspect}" unless controller_path && controller_path.size > 0
+ fail "Invalid controller path: #{controller_path.inspect}" unless controller_path && controller_path.size > 0
action = controller_path[-1]
# Get the constant parts
parts = controller_path[0..-2].map { |v| v.tr('-', '_').camelize }
@@ -63,6 +61,6 @@
end
[obj, action]
end
end
-end
\ No newline at end of file
+end