Skip to content

Commit

Permalink
added workaround for following issue
Browse files Browse the repository at this point in the history
  • Loading branch information
taichi-ishitani committed Feb 27, 2019
1 parent bb24d39 commit 4e924e5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 16 additions & 0 deletions lib/rggen/core/core_extensions/module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,20 @@ def define_private_method(name, body = nil)
body ||= proc if block_given?
define_method(name, body).tap { private(name) }
end

# workaround for following issue
# https://github.com/rubyworks/facets/issues/286
def attr_setter(*args)
code, made = +'', []
args.each do |a|
code << %{
def #{a}(*args)
args.size > 0 ? ( @#{a}=args[0] ; self ) : @#{a}
end
}
made << "#{a}".to_sym
end
module_eval code
made
end
end
1 change: 0 additions & 1 deletion lib/rggen/core/facets.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'facets/array/merge'
require 'facets/file/ext'
require 'facets/hash/symbolize_keys'
require 'facets/module/attr_setter'
require 'facets/pathname/to_path'
require 'facets/string/variablize'
require 'facets/symbol/variablize'

0 comments on commit 4e924e5

Please sign in to comment.