Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing private API method: Hanami::CLI::Generators::Context#ruby_implicity_keyword_argument? #118

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/hanami/cli/generators/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ def bundled_assets?
Hanami.bundled?("hanami-assets")
end

# @since 2.1.0
# @api private
#
# @see https://rubyreferences.github.io/rubychanges/3.1.html#values-in-hash-literals-and-keyword-arguments-can-be-omitted
def ruby_implicity_keyword_argument?
RUBY_VERSION >= "3.1"
end

private

# @since 2.0.0
Expand Down
22 changes: 22 additions & 0 deletions spec/unit/hanami/cli/generators/context_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

require "dry/inflector"

RSpec.describe Hanami::CLI::Generators::Context do
subject { described_class.new(inflector, app) }

let(:inflector) { Dry::Inflector.new }
let(:app) { double("app") }

describe "#ruby_implicity_keyword_argument?" do
if RUBY_VERSION >= "3.1"
it "returns true" do
expect(subject.ruby_implicity_keyword_argument?).to be(true)
end
else
it "returns false" do
expect(subject.ruby_implicity_keyword_argument?).to be(false)
end
end
end
end