Class: Hash2lrtemplate::Convertor

Inherits:
Object
  • Object
show all
Includes:
CallableClass
Defined in:
lib/hash2lrtemplate/convertor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hashObject (readonly)

Returns the value of attribute hash.



9
10
11
# File 'lib/hash2lrtemplate/convertor.rb', line 9

def hash
  @hash
end

Instance Method Details

#callString

Converts the hash to JSON and call JSON2lrtemplate.call

Returns:

  • (String)

    Converted string



22
23
24
# File 'lib/hash2lrtemplate/convertor.rb', line 22

def call
  convert
end