Add some more doc
This commit is contained in:
parent
a56080e3ee
commit
b337198350
|
@ -6,23 +6,38 @@ module Rubella
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
class JSON
|
class JSON
|
||||||
|
|
||||||
attr_reader :data
|
attr_reader :data
|
||||||
|
|
||||||
|
# Constructor
|
||||||
|
# This constructer can create a new Rubella::Input::JSON object, but it
|
||||||
|
# is supposed to be private. Please use Rubella::Input::JSON.string or
|
||||||
|
# Rubella::Input::JSON.file to create a new instance.
|
||||||
|
#
|
||||||
|
# @param json__string string A string, which contains the data as json
|
||||||
|
# @return Rubella::Input::JSON
|
||||||
def initialize(json_string)
|
def initialize(json_string)
|
||||||
@data = ::JSON::load(json_string)
|
@data = ::JSON::load(json_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Constructor
|
||||||
|
# Creates a new Rubella::Input::JSON object, from the given json.
|
||||||
|
#
|
||||||
|
# @param json_string string A string, which contains the data as json
|
||||||
|
# @return Rubella::Input::JSON
|
||||||
def self.string(json_string)
|
def self.string(json_string)
|
||||||
self.new(json_string)
|
self.new(json_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Constructor
|
||||||
|
# Creates a new Rubella::Input::JSON object, from the given file.
|
||||||
|
# Only the file name is required.
|
||||||
|
#
|
||||||
|
# @param json_file string The name of the file, which json contains
|
||||||
|
# @return Rubella:Input::JSON
|
||||||
def self.file(json_file)
|
def self.file(json_file)
|
||||||
self.new File.new(json_file, 'r')
|
self.new File.new(json_file, 'r')
|
||||||
end
|
end
|
||||||
|
|
||||||
# private :new
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue