Class: JSON2Ruby::Primitive
- Inherits:
-
Object
- Object
- JSON2Ruby::Primitive
- Defined in:
- lib/json2ruby/primitive.rb
Overview
Represents a JSON Primitive. You should not instantiate this class - use the static instances:
-
JSON2Ruby::RUBYSTRING for JSON Strings
-
JSON2Ruby::RUBYINTEGER for JSON Integers
-
JSON2Ruby::RUBYFLOAT for JSON Floats
-
JSON2Ruby::RUBYBOOLEAN for JSON Booleans
-
JSON2Ruby::RUBYNUMERIC for JSON Numerics (Integers or floats)
Instance Attribute Summary collapse
-
#attr_hash ⇒ Object
The static
attr_hashof the Primitive. -
#name ⇒ Object
The
Stringname of the Primitive. -
#original_name ⇒ Object
StringExists for compatibility.
Class Method Summary collapse
-
.short_name ⇒ Object
The short name is ‘Primitive’.
Instance Method Summary collapse
-
#comment ⇒ Object
Return the
nameof the Primitive. -
#initialize(name, attr_hash) ⇒ Primitive
constructor
Create a new Primitive with the specified
nameandattr_hash.
Constructor Details
#initialize(name, attr_hash) ⇒ Primitive
Create a new Primitive with the specified name and attr_hash
22 23 24 25 |
# File 'lib/json2ruby/primitive.rb', line 22 def initialize(name, attr_hash) @name = name @attr_hash = attr_hash end |
Instance Attribute Details
#attr_hash ⇒ Object
The static attr_hash of the Primitive.
14 15 16 |
# File 'lib/json2ruby/primitive.rb', line 14 def attr_hash @attr_hash end |
#name ⇒ Object
The String name of the Primitive.
10 11 12 |
# File 'lib/json2ruby/primitive.rb', line 10 def name @name end |
#original_name ⇒ Object
String Exists for compatibility.
12 13 14 |
# File 'lib/json2ruby/primitive.rb', line 12 def original_name @original_name end |
Class Method Details
.short_name ⇒ Object
The short name is ‘Primitive’
17 18 19 |
# File 'lib/json2ruby/primitive.rb', line 17 def self.short_name "Primitive" end |
Instance Method Details
#comment ⇒ Object
Return the name of the Primitive
28 29 30 |
# File 'lib/json2ruby/primitive.rb', line 28 def comment @name end |