Class: Hash2lrtemplate::Convertor
- Inherits:
-
Object
- Object
- Hash2lrtemplate::Convertor
- Includes:
- CallableClass
- Defined in:
- lib/hash2lrtemplate/convertor.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
-
#call ⇒ String
Converts the hash to JSON and call JSON2lrtemplate.call.
-
#initialize(hash) ⇒ Convertor
constructor
A new instance of Convertor.
Constructor Details
#initialize(hash) ⇒ Convertor
Returns a new instance of Convertor.
11 12 13 14 15 |
# File 'lib/hash2lrtemplate/convertor.rb', line 11 def initialize(hash) raise Hash2lrtemplate::Error, 'Invalid class. Expected class: `Hash`.' unless hash.is_a?(Hash) @hash = hash end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
9 10 11 |
# File 'lib/hash2lrtemplate/convertor.rb', line 9 def hash @hash end |
Instance Method Details
#call ⇒ String
Converts the hash to JSON and call JSON2lrtemplate.call
22 23 24 |
# File 'lib/hash2lrtemplate/convertor.rb', line 22 def call convert end |