class Hash2lrtemplate::Convertor

Attributes

hash[R]

Public Class Methods

new(hash) click to toggle source
# 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

Public Instance Methods

call() click to toggle source

Converts the hash to JSON and call {Hash2lrtemplate::JSON2lrtemplate.call}

@return [String] Converted string

# File lib/hash2lrtemplate/convertor.rb, line 22
def call
  convert
end

Private Instance Methods

convert() click to toggle source
# File lib/hash2lrtemplate/convertor.rb, line 28
def convert
  json_string = @hash.to_json
  Hash2lrtemplate::JSON2lrtemplate.call(json_string)
end