summaryrefslogtreecommitdiff
path: root/lib/json
diff options
context:
space:
mode:
Diffstat (limited to 'lib/json')
-rw-r--r--lib/json/common.rb2
-rw-r--r--lib/json/generic_object.rb (renamed from lib/json/light_object.rb)14
2 files changed, 5 insertions, 11 deletions
diff --git a/lib/json/common.rb b/lib/json/common.rb
index e8e76b6..a30e4ce 100644
--- a/lib/json/common.rb
+++ b/lib/json/common.rb
@@ -1,5 +1,5 @@
require 'json/version'
-require 'json/light_object'
+require 'json/generic_object'
module JSON
class << self
diff --git a/lib/json/light_object.rb b/lib/json/generic_object.rb
index 07eeecf..7f3dbbd 100644
--- a/lib/json/light_object.rb
+++ b/lib/json/generic_object.rb
@@ -1,7 +1,7 @@
require 'ostruct'
module JSON
- class LightObject < OpenStruct
+ class GenericObject < OpenStruct
class << self
alias [] new
@@ -17,11 +17,11 @@ module JSON
end
def [](name)
- to_hash[name.to_sym]
+ table[name.to_sym]
end
def []=(name, value)
- modifiable[name.to_sym] = value
+ __send__ "#{name}=", value
end
def |(other)
@@ -29,17 +29,11 @@ module JSON
end
def as_json(*)
- to_hash | { JSON.create_id => self.class.name }
+ { JSON.create_id => self.class.name }.merge to_hash
end
def to_json(*a)
as_json.to_json(*a)
end
-
- def method_missing(*a, &b)
- to_hash.__send__(*a, &b)
- rescue NoMethodError
- super
- end
end
end