From 24f84d63beef15eafd2e59df3d809f1928774d00 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 8 Jul 2011 17:25:17 +0900 Subject: remove trailing spaces. --- lib/json.rb | 8 ++++---- lib/json/add/core.rb | 14 +++++++------- lib/json/common.rb | 2 +- lib/json/editor.rb | 32 ++++++++++++++++---------------- lib/json/pure/generator.rb | 2 +- lib/json/pure/parser.rb | 6 +++--- 6 files changed, 32 insertions(+), 32 deletions(-) (limited to 'lib') diff --git a/lib/json.rb b/lib/json.rb index cc33f72..d7bc1a2 100644 --- a/lib/json.rb +++ b/lib/json.rb @@ -15,7 +15,7 @@ # # To parse a JSON string received by another application, or generated within # your existing application: -# +# # require 'json' # # my_hash = JSON.parse('{"hello": "goodbye"}') @@ -32,7 +32,7 @@ # just as simple. # # require 'json' -# +# # my_hash = {:hello => "goodbye"} # puts JSON.generate(my_hash) => "{\"hello\":\"goodbye\"}" # @@ -41,8 +41,8 @@ # require 'json' # puts {:hello => "goodbye"}.to_json => "{\"hello\":\"goodbye\"}" # -# JSON.generate only allows objects or arrays to be converted -# to JSON syntax. While to_json accepts many Ruby classes +# JSON.generate only allows objects or arrays to be converted +# to JSON syntax. While to_json accepts many Ruby classes # even though it only acts a method for serialization: # # require 'json' diff --git a/lib/json/add/core.rb b/lib/json/add/core.rb index 9c06a9b..e9850af 100644 --- a/lib/json/add/core.rb +++ b/lib/json/add/core.rb @@ -21,7 +21,7 @@ class Symbol def to_json(*a) as_json.to_json(*a) end - + # Deserializes JSON string by converting the string value stored in the object to a Symbol def self.json_create(o) o['s'].to_sym @@ -52,7 +52,7 @@ class Time 'n' => respond_to?(:tv_nsec) ? tv_nsec : tv_usec * 1000 } end - + # Stores class name (Time) with number of seconds since epoch and number of # microseconds for Time as JSON string def to_json(*args) @@ -62,7 +62,7 @@ end # Date serialization/deserialization class Date - + # Deserializes JSON string by converting Julian year y, month # m, day d and Day of Calendar Reform sg to Date. def self.json_create(object) @@ -80,7 +80,7 @@ class Date 'm' => month, 'd' => day, 'sg' => start, - } + } end # Stores class name (Date) with Julian year y, month m, day @@ -123,7 +123,7 @@ class DateTime 'S' => sec, 'of' => offset.to_s, 'sg' => start, - } + } end # Stores class name (DateTime) with Julian year y, month m, @@ -136,7 +136,7 @@ end # Range serialization/deserialization class Range - + # Deserializes JSON string by constructing new Range object with arguments # a serialized by to_json. def self.json_create(object) @@ -162,7 +162,7 @@ end # Struct serialization/deserialization class Struct - + # Deserializes JSON string by constructing new Struct object with values # v serialized by to_json. def self.json_create(object) diff --git a/lib/json/common.rb b/lib/json/common.rb index 1cbbf1c..1a5f048 100644 --- a/lib/json/common.rb +++ b/lib/json/common.rb @@ -291,7 +291,7 @@ module JSON recurse_proc(result, &proc) if proc result end - + # Recursively calls passed _Proc_ if the parsed data structure is an _Array_ or _Hash_ def recurse_proc(result, &proc) case result diff --git a/lib/json/editor.rb b/lib/json/editor.rb index 3450455..985a554 100644 --- a/lib/json/editor.rb +++ b/lib/json/editor.rb @@ -47,14 +47,14 @@ module JSON # Opens an error dialog on top of _window_ showing the error message # _text_. def Editor.error_dialog(window, text) - dialog = MessageDialog.new(window, Dialog::MODAL, - MessageDialog::ERROR, + dialog = MessageDialog.new(window, Dialog::MODAL, + MessageDialog::ERROR, MessageDialog::BUTTONS_CLOSE, text) dialog.show_all dialog.run rescue TypeError - dialog = MessageDialog.new(Editor.window, Dialog::MODAL, - MessageDialog::ERROR, + dialog = MessageDialog.new(Editor.window, Dialog::MODAL, + MessageDialog::ERROR, MessageDialog::BUTTONS_CLOSE, text) dialog.show_all dialog.run @@ -66,8 +66,8 @@ module JSON # message _text_. If yes was answered _true_ is returned, otherwise # _false_. def Editor.question_dialog(window, text) - dialog = MessageDialog.new(window, Dialog::MODAL, - MessageDialog::QUESTION, + dialog = MessageDialog.new(window, Dialog::MODAL, + MessageDialog::QUESTION, MessageDialog::BUTTONS_YES_NO, text) dialog.show_all dialog.run do |response| @@ -464,7 +464,7 @@ module JSON add_separator add_item("Append new node", ?a, &method(:append_new_node)) add_item("Insert new node before", ?i, &method(:insert_new_node)) - add_separator + add_separator add_item("Collapse/Expand node (recursively)", ?e, &method(:collapse_expand)) @@ -503,7 +503,7 @@ module JSON # Revert the current JSON document in the editor to the saved version. def revert(item) window.instance_eval do - @filename and file_open(@filename) + @filename and file_open(@filename) end end @@ -665,7 +665,7 @@ module JSON collapse_all else self.expanded = true - expand_all + expand_all end end @@ -884,7 +884,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all self.focus = dialog - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT @key = key_input.text type = ALL_TYPES[@type = type_input.active] @@ -936,7 +936,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all self.focus = dialog - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT type = types[type_input.active] @content = case type @@ -981,7 +981,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all self.focus = dialog - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT return @order = order_input.text, reverse_checkbox.active? end @@ -1016,7 +1016,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all self.focus = dialog - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT begin return Regexp.new(regex_input.text, icase_checkbox.active? ? Regexp::IGNORECASE : 0) @@ -1215,7 +1215,7 @@ module JSON end end - # Save the current file as the filename + # Save the current file as the filename def file_save_as filename = select_file('Save as a JSON file') store_file(filename) @@ -1241,7 +1241,7 @@ module JSON rescue SystemCallError => e Editor.error_dialog(self, "Failed to store JSON file: #{e}!") end - + # Load the file named _filename_ into the editor as a JSON document. def load_file(filename) if filename @@ -1333,7 +1333,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT return @location = location_input.text end diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb index 9790250..3687e30 100644 --- a/lib/json/pure/generator.rb +++ b/lib/json/pure/generator.rb @@ -125,7 +125,7 @@ module JSON # * *indent*: a string used to indent levels (default: ''), # * *space*: a string that is put after, a : or , delimiter (default: ''), # * *space_before*: a string that is put before a : pair delimiter (default: ''), - # * *object_nl*: a string that is put at the end of a JSON object (default: ''), + # * *object_nl*: a string that is put at the end of a JSON object (default: ''), # * *array_nl*: a string that is put at the end of a JSON array (default: ''), # * *check_circular*: is deprecated now, use the :max_nesting option instead, # * *max_nesting*: sets the maximum level of data structure nesting in diff --git a/lib/json/pure/parser.rb b/lib/json/pure/parser.rb index 8043e67..d612018 100644 --- a/lib/json/pure/parser.rb +++ b/lib/json/pure/parser.rb @@ -41,7 +41,7 @@ module JSON [^*/]| # normal chars /[^*]| # slashes that do not start a nested comment \*[^/]| # asterisks that do not end this comment - /(?=\*/) # single slash before this comment's end + /(?=\*/) # single slash before this comment's end )* \*/ # the End of this comment |[ \t\r\n]+ # whitespaces: space, horicontal tab, lf, cr @@ -162,12 +162,12 @@ module JSON ?n => "\n", ?r => "\r", ?t => "\t", - ?u => nil, + ?u => nil, }) EMPTY_8BIT_STRING = '' if ::String.method_defined?(:encode) - EMPTY_8BIT_STRING.force_encoding Encoding::ASCII_8BIT + EMPTY_8BIT_STRING.force_encoding Encoding::ASCII_8BIT end def parse_string -- cgit v1.2.1