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

Adapt Module#attr_setter to frozen-string-literal #287

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ language: ruby
sudo: false

before_install:
- gem update --system
- "if $(ruby -e 'exit(RUBY_VERSION >= \"2.3.0\")'); then gem update --system; fi"
- "if $(ruby -e 'exit(RUBY_VERSION < \"2.3.0\")'); then gem update --system 2.7.8; fi"
# bundler installation needed for jruby-head
# https://github.com/travis-ci/travis-ci/issues/5861
- gem install bundler
- "if $(ruby -e 'exit(RUBY_VERSION >= \"2.3.0\")'); then gem install bundler; fi"
- "if $(ruby -e 'exit(RUBY_VERSION < \"2.3.0\")'); then gem install bundler --version 1.17.3; fi"

script: "bundle exec rubytest -Ilib test/ --verbose"
bundler_args: --without guard
Expand Down
5 changes: 3 additions & 2 deletions lib/core/facets/module/attr_setter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Module

# Create an attribute method for both getting
Expand All @@ -19,7 +20,7 @@ class Module
# CREDIT: Trans

def attr_setter(*args)
code, made = '', []
code, made = [], []
args.each do |a|
code << %{
def #{a}(*args)
Expand All @@ -28,7 +29,7 @@ def #{a}(*args)
}
made << "#{a}".to_sym
end
module_eval code
module_eval code.join
made
end

Expand Down