class Lono::Yamler::Loader

Public Class Methods

load(text) click to toggle source
# File lib/lono/yamler/loader.rb, line 5
def self.load(text)
  new(text).load
end
new(text) click to toggle source
# File lib/lono/yamler/loader.rb, line 9
def initialize(text)
  @text = text
end

Public Instance Methods

load() click to toggle source
# File lib/lono/yamler/loader.rb, line 13
def load
  add_domain_types!
  YAML.load(@text)
end

Private Instance Methods

add_domain_types!() click to toggle source
# File lib/lono/yamler/loader.rb, line 19
def add_domain_types!
  intrinsic_functions.each do |name|
    YAML.add_domain_type('', name) do |type,val|
      key = type.split('::').last
      key = "Fn::" + key unless name == 'Ref'
      { key => val }
    end
  end
end
intrinsic_functions() click to toggle source
# File lib/lono/yamler/loader.rb, line 29
def intrinsic_functions
  %w[
    And
    Base64
    Cidr
    Equals
    FindInMap
    GetAtt
    GetAZs
    If
    If
    ImportValue
    Join
    Not
    Or
    Ref
    Select
    Split
    Sub
    Transform
  ]
end