diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/json.rb | 1 | ||||
-rw-r--r-- | lib/json/add/bigdecimal.rb | 1 | ||||
-rw-r--r-- | lib/json/add/complex.rb | 3 | ||||
-rw-r--r-- | lib/json/add/core.rb | 1 | ||||
-rw-r--r-- | lib/json/add/date.rb | 1 | ||||
-rw-r--r-- | lib/json/add/date_time.rb | 1 | ||||
-rw-r--r-- | lib/json/add/exception.rb | 1 | ||||
-rw-r--r-- | lib/json/add/ostruct.rb | 1 | ||||
-rw-r--r-- | lib/json/add/range.rb | 1 | ||||
-rw-r--r-- | lib/json/add/rational.rb | 1 | ||||
-rw-r--r-- | lib/json/add/regexp.rb | 1 | ||||
-rw-r--r-- | lib/json/add/struct.rb | 1 | ||||
-rw-r--r-- | lib/json/add/symbol.rb | 1 | ||||
-rw-r--r-- | lib/json/add/time.rb | 1 | ||||
-rw-r--r-- | lib/json/common.rb | 1 | ||||
-rw-r--r-- | lib/json/generic_object.rb | 9 | ||||
-rw-r--r-- | lib/json/pure/generator.rb | 1 | ||||
-rw-r--r-- | lib/json/pure/parser.rb | 1 |
18 files changed, 23 insertions, 5 deletions
diff --git a/lib/json.rb b/lib/json.rb index 24aa385..b5a6912 100644 --- a/lib/json.rb +++ b/lib/json.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false require 'json/common' ## diff --git a/lib/json/add/bigdecimal.rb b/lib/json/add/bigdecimal.rb index 0ef69f1..539daee 100644 --- a/lib/json/add/bigdecimal.rb +++ b/lib/json/add/bigdecimal.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/complex.rb b/lib/json/add/complex.rb index 2723f60..28ef734 100644 --- a/lib/json/add/complex.rb +++ b/lib/json/add/complex.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end @@ -25,4 +26,4 @@ class Complex def to_json(*) as_json.to_json end -end
\ No newline at end of file +end diff --git a/lib/json/add/core.rb b/lib/json/add/core.rb index 77d9dc0..bfb017c 100644 --- a/lib/json/add/core.rb +++ b/lib/json/add/core.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false # This file requires the implementations of ruby core's custom objects for # serialisation/deserialisation. diff --git a/lib/json/add/date.rb b/lib/json/add/date.rb index 458d9eb..2552356 100644 --- a/lib/json/add/date.rb +++ b/lib/json/add/date.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/date_time.rb b/lib/json/add/date_time.rb index a1009cf..38b0e86 100644 --- a/lib/json/add/date_time.rb +++ b/lib/json/add/date_time.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/exception.rb b/lib/json/add/exception.rb index f4b150d..a107e5b 100644 --- a/lib/json/add/exception.rb +++ b/lib/json/add/exception.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/ostruct.rb b/lib/json/add/ostruct.rb index a62f92f..7c13910 100644 --- a/lib/json/add/ostruct.rb +++ b/lib/json/add/ostruct.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/range.rb b/lib/json/add/range.rb index 0df382c..93529fb 100644 --- a/lib/json/add/range.rb +++ b/lib/json/add/range.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/rational.rb b/lib/json/add/rational.rb index ee39c20..356940b 100644 --- a/lib/json/add/rational.rb +++ b/lib/json/add/rational.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/regexp.rb b/lib/json/add/regexp.rb index 9adf06c..a93866b 100644 --- a/lib/json/add/regexp.rb +++ b/lib/json/add/regexp.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/struct.rb b/lib/json/add/struct.rb index e1e2480..e8395ed 100644 --- a/lib/json/add/struct.rb +++ b/lib/json/add/struct.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/symbol.rb b/lib/json/add/symbol.rb index 6df77ca..74b13a4 100644 --- a/lib/json/add/symbol.rb +++ b/lib/json/add/symbol.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/add/time.rb b/lib/json/add/time.rb index 1227508..b73acc4 100644 --- a/lib/json/add/time.rb +++ b/lib/json/add/time.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end diff --git a/lib/json/common.rb b/lib/json/common.rb index 55908f8..b53041b 100644 --- a/lib/json/common.rb +++ b/lib/json/common.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false require 'json/version' require 'json/generic_object' diff --git a/lib/json/generic_object.rb b/lib/json/generic_object.rb index 8b8fd53..108309d 100644 --- a/lib/json/generic_object.rb +++ b/lib/json/generic_object.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false require 'ostruct' module JSON @@ -48,12 +49,12 @@ module JSON end def [](name) - table[name.to_sym] - end + __send__(name) + end unless method_defined?(:[]) def []=(name, value) - __send__ "#{name}=", value - end + __send__("#{name}=", value) + end unless method_defined?(:[]=) def |(other) self.class[other.to_hash.merge(to_hash)] diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb index 98bc369..ccb6fe4 100644 --- a/lib/json/pure/generator.rb +++ b/lib/json/pure/generator.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false module JSON MAP = { "\x0" => '\u0000', diff --git a/lib/json/pure/parser.rb b/lib/json/pure/parser.rb index f02f408..b907236 100644 --- a/lib/json/pure/parser.rb +++ b/lib/json/pure/parser.rb @@ -1,3 +1,4 @@ +#frozen_string_literal: false require 'strscan' module JSON |