Class: Shaf::ALPS::JsonSerializer
- Inherits:
-
Object
- Object
- Shaf::ALPS::JsonSerializer
- Defined in:
- lib/shaf/alps/json_serializer.rb
Constant Summary collapse
- ALPS_VERSION =
'1.0'
Instance Attribute Summary collapse
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(profile) ⇒ JsonSerializer
constructor
A new instance of JsonSerializer.
- #to_hash ⇒ Object
Constructor Details
#initialize(profile) ⇒ JsonSerializer
Returns a new instance of JsonSerializer.
17 18 19 |
# File 'lib/shaf/alps/json_serializer.rb', line 17 def initialize(profile) @profile = profile end |
Instance Attribute Details
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
15 16 17 |
# File 'lib/shaf/alps/json_serializer.rb', line 15 def profile @profile end |
Class Method Details
.call(profile) ⇒ Object
11 12 13 |
# File 'lib/shaf/alps/json_serializer.rb', line 11 def self.call(profile) new(profile).to_hash end |
Instance Method Details
#to_hash ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/shaf/alps/json_serializer.rb', line 21 def to_hash { alps: { version: ALPS_VERSION, doc: profile.doc, descriptor: descriptors, }.compact } end |