Skip to content

Commit

Permalink
Merge branch 'main' into 2.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jodosha committed Oct 30, 2023
2 parents 15da1b1 + 89fa278 commit b20635b
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 21 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

View layer for Hanami

## v2.1.0.rc1 - 2023-11-01

### Fixed
- [Tim Riley] Include methods from helper modules as public (#242)
Replace `module_function` with `extend self` to allow helper methods to remain directly usable on their modules, but to also let those methods remain public when the module is included in a class.
This will allow an intermediary `helpers` object to be created for view parts (inside full Hanami apps) to access the standard helpers.

## v2.1.0.beta2 - 2023-10-04

### Added
Expand Down
2 changes: 1 addition & 1 deletion hanami-view.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "dry-core", "~> 1.0"
spec.add_runtime_dependency "dry-inflector", "~> 1.0", "< 2"
spec.add_runtime_dependency "temple", "~> 0.10.0", ">= 0.10.2"
spec.add_runtime_dependency "tilt", "~> 2.0", ">= 2.0.6"
spec.add_runtime_dependency "tilt", "~> 2.3"
spec.add_runtime_dependency "zeitwerk", "~> 2.6"

spec.add_development_dependency "bundler"
Expand Down
2 changes: 1 addition & 1 deletion lib/hanami/view/helpers/escape_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module Helpers
# @api public
# @since 2.0.0
module EscapeHelper
module_function
extend self

# Returns an escaped string that is safe to include in HTML.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/hanami/view/helpers/number_formatting_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module Helpers
# @api public
# @since 2.0.0
module NumberFormattingHelper
module_function
extend self

# Default delimiter
#
Expand Down
2 changes: 1 addition & 1 deletion lib/hanami/view/helpers/tag_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module Helpers
# @api public
# @since 2.0.0
module TagHelper
module_function
extend self

# Returns a tag builder for building HTML tag strings.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/hanami/view/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
module Hanami
class View
# @api private
VERSION = "2.1.0.beta2"
VERSION = "2.1.0.rc1"
end
end
4 changes: 0 additions & 4 deletions spec/unit/helpers/escape_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ def h(&block)
obj.instance_eval(&block)
end

it "includes private helpers only" do
expect { obj.escape_html }.to raise_error(NoMethodError)
end

# See escape_hepler/escape_html_spec.rb for complete tests
describe "#escape_html" do
it "escapes HTML" do
Expand Down
12 changes: 0 additions & 12 deletions spec/unit/helpers/tag_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
# frozen_string_literal: true

RSpec.describe Hanami::View::Helpers::TagHelper do
describe "inclusion" do
subject(:obj) {
Class.new {
include Hanami::View::Helpers::TagHelper
}.new
}

it "includes private helpers only" do
expect { obj.tag }.to raise_error(NoMethodError)
end
end

describe "#tag" do
def tag(...)
described_class.tag(...)
Expand Down

0 comments on commit b20635b

Please sign in to comment.