File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
src/main/ruby/truffleruby/core Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 31
31
data . unit . should == "km"
32
32
end
33
33
34
+ it "accepts String keyword arguments" do
35
+ data = DataSpecs ::Measure . new ( "amount" => 42 , "unit" => "km" )
36
+
37
+ data . amount . should == 42
38
+ data . unit . should == "km"
39
+ end
40
+
34
41
it "raises ArgumentError if no arguments are given" do
35
42
-> {
36
43
DataSpecs ::Measure . new
Original file line number Diff line number Diff line change @@ -84,12 +84,13 @@ def self.new(*args, **kwargs)
84
84
# CRuby defines these directly on Data, but that is suboptimal for performance.
85
85
# We want to have a specialized copy of these methods for each Data subclass.
86
86
instance_methods_module = Module . new
87
- instance_methods_module . module_eval "#{ <<~'RUBY' } "
87
+ instance_methods_module . module_eval "#{ <<~'RUBY' } " , __FILE__ , __LINE__ + 1
88
88
# truffleruby_primitives: true
89
89
90
90
def initialize(**kwargs)
91
91
members_hash = Primitive.class(self)::CLASS_MEMBERS_HASH
92
92
kwargs.each do |member, value|
93
+ member = member.to_sym
93
94
if members_hash.include?(member)
94
95
Primitive.object_hidden_var_set(self, member, value)
95
96
else
You can’t perform that action at this time.
0 commit comments