Skip to content

Commit

Permalink
Tempoprary reverted changes related to Struct.
Browse files Browse the repository at this point in the history
  • Loading branch information
iliabylich committed Sep 3, 2015
1 parent 15befb9 commit 4687956
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions opal/corelib/struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ def self.define_struct_attribute(name)

members << name

define_method name do
data[name]
end

define_method "#{name}=" do |value|
data[name] = value
end
attr_accessor name
end

def self.members
Expand All @@ -57,7 +51,7 @@ class << self

def initialize(*args)
members.each_with_index {|name, index|
data[name] = args[index]
instance_variable_set "@#{name}", args[index]
}
end

Expand All @@ -81,7 +75,7 @@ def [](name)
raise TypeError, "no implicit conversion of #{name.class} into Integer"
end

data[name]
instance_variable_get "@#{name}"
end

def []=(name, value)
Expand All @@ -96,7 +90,7 @@ def []=(name, value)
raise TypeError, "no implicit conversion of #{name.class} into Integer"
end

data[name] = value
instance_variable_set "@#{name}", value
end

def each
Expand Down

0 comments on commit 4687956

Please sign in to comment.