File tree 2 files changed +16
-1
lines changed 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,20 @@ def define_private_method(name, body = nil)
9
9
body ||= proc if block_given?
10
10
define_method ( name , body ) . tap { private ( name ) }
11
11
end
12
+
13
+ # workaround for following issue
14
+ # https://github.com/rubyworks/facets/issues/286
15
+ def attr_setter ( *args )
16
+ code , made = +'' , [ ]
17
+ args . each do |a |
18
+ code << %{
19
+ def #{ a } (*args)
20
+ args.size > 0 ? ( @#{ a } =args[0] ; self ) : @#{ a }
21
+ end
22
+ }
23
+ made << "#{ a } " . to_sym
24
+ end
25
+ module_eval code
26
+ made
27
+ end
12
28
end
Original file line number Diff line number Diff line change 1
1
require 'facets/array/merge'
2
2
require 'facets/file/ext'
3
3
require 'facets/hash/symbolize_keys'
4
- require 'facets/module/attr_setter'
5
4
require 'facets/pathname/to_path'
6
5
require 'facets/string/variablize'
7
6
require 'facets/symbol/variablize'
You can’t perform that action at this time.
0 commit comments