Skip to content

Commit

Permalink
Small changes to the visibility variable assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
mereghost committed Jun 21, 2016
1 parent 1d37fa0 commit 088ebd6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/hanami/view/escape.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ def self.extended(base)
# @since 0.4.0 # @since 0.4.0
# @api private # @api private
def method_added(method_name) def method_added(method_name)
visibility = :public
visibility = :private if private_method_defined? method_name visibility = :private if private_method_defined? method_name
visibility ||= :protected if protected_method_defined? method_name visibility = :protected if protected_method_defined? method_name


unless autoescape_methods[method_name] unless autoescape_methods[method_name]
prepend Module.new { prepend Module.new {
Expand Down
1 change: 1 addition & 0 deletions test/escape_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
it "does not alter the method visibility" do it "does not alter the method visibility" do
Users::Show.private_instance_methods.must_include(:private_username) Users::Show.private_instance_methods.must_include(:private_username)
Users::Show.protected_instance_methods.must_include(:protected_username) Users::Show.protected_instance_methods.must_include(:protected_username)
Users::Show.public_instance_methods.must_include(:raw_username)
end end
end end

0 comments on commit 088ebd6

Please sign in to comment.