Skip to content

Commit

Permalink
Avoid splat operator and use symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
theldoria committed May 1, 2018
1 parent be85424 commit 0c8ec6e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/mf/public_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ module PublicApi
# Handle most operators
def method_missing(cmd, *args)
eigenclass = class << self; self; end
cmd_sym = cmd.to_sym
eigenclass.class_eval do
define_method(cmd) do |*b|
proc { |a| a.send(cmd, *b) }
define_method(cmd_sym) do |b|
proc { |a| a.send(cmd_sym, b) }
end
end
send(cmd, *args)
Expand Down

0 comments on commit 0c8ec6e

Please sign in to comment.