Skip to content

Commit cff6ce9

Browse files
committed
Make some changes suggested by Fasterer
1 parent e0a7240 commit cff6ce9

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

lib/truffle/date.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ class Infinity < Numeric # :nodoc:
258258

259259
def initialize(d=1) @d = d <=> 0 end
260260

261-
def d() @d end
262-
261+
attr_reader :d
263262
protected :d
264263

265264
def zero? () false end
@@ -1144,7 +1143,7 @@ def initialize(ajd=0, of=0, sg=ITALY)
11441143
end
11451144

11461145
# Get the date as an Astronomical Julian Day Number.
1147-
def ajd() @ajd end
1146+
attr_reader :ajd
11481147

11491148
# Get the date as an Astronomical Modified Julian Day Number.
11501149
def amjd() ajd_to_amjd(@ajd) end

lib/truffle/date/delta.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def self.diff(d1, d2) new(d1.ajd - d2.ajd) end
187187
class << self
188188

189189
def once(*ids) # :nodoc: -- restricted
190-
for id in ids
190+
ids.each do |id|
191191
module_eval <<-"end;"
192192
alias_method :__#{id.object_id}__, :#{id}
193193
private :__#{id.object_id}__
@@ -206,8 +206,7 @@ def dhms() self.class.delta_to_dhms(@delta) end
206206

207207
once :dhms
208208

209-
def delta() @delta end
210-
209+
attr_reader :delta
211210
protected :delta
212211

213212
def years() dhms[0] end

lib/truffle/rbconfig-for-mkmf.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,5 @@
109109
mkconfig['TRY_LINK'] = "#{cc} -o conftest $(INCFLAGS) $(CPPFLAGS) #{cflags_for_try_link} #{cext_dir}/ruby.o #{cext_dir}/sulongmock.o $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
110110

111111
%w[COMPILE_C COMPILE_CXX TRY_LINK].each do |key|
112-
expanded[key] = mkconfig[key].gsub(/\$\((\w+)\)/) { expanded.fetch($1, $&) }
112+
expanded[key] = mkconfig[key].gsub(/\$\((\w+)\)/) { expanded.fetch($1) { $& } }
113113
end

lib/truffle/rubygems/extra_executables_installer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ def remove_hooks(install_hook, uninstall_hook)
1818

1919
private
2020

21-
def with_bin_dir(obj, new_bin_dir, &block)
21+
def with_bin_dir(obj, new_bin_dir)
2222
old_bin_dir = obj.instance_variable_get :@bin_dir
2323
obj.instance_variable_set :@bin_dir, new_bin_dir
2424
begin
25-
block.call
25+
yield
2626
ensure
2727
obj.instance_variable_set :@bin_dir, old_bin_dir
2828
end

lib/truffle/truffle/cext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ def rb_str_encode(str, to, ecflags, ecopts)
913913

914914
# TODO BJF 8-Mar-2017 Handle more ecflags
915915
if ecflags & Encoding::Converter::INVALID_REPLACE != 0
916-
opts.merge!({:invalid => :replace})
916+
opts[:invalid] = :replace
917917
end
918918

919919
if opts.empty?

0 commit comments

Comments
 (0)