Sha256: fec867731720ef490e2e4d5363717e318973926e682232903bb9e10e42e623ad

Contents?: true

Size: 759 Bytes

Versions: 36

Compression:

Stored size: 759 Bytes

Contents

require "yaml"

class Ufo::Yaml
  class Loader
    def initialize(text)
      @text = text
    end

    def load
      add_domain_types!
      YAML.load(@text)
    end

  private
    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

    def intrinsic_functions
      %w[
        And
        Base64
        Cidr
        Equals
        FindInMap
        GetAtt
        GetAZs
        If
        If
        ImportValue
        Join
        Not
        Or
        Ref
        Select
        Split
        Sub
        Transform
      ]
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
ufo-6.1.5 lib/ufo/yaml/loader.rb
ufo-6.1.4 lib/ufo/yaml/loader.rb
ufo-6.1.3 lib/ufo/yaml/loader.rb
ufo-6.1.2 lib/ufo/yaml/loader.rb
ufo-6.1.1 lib/ufo/yaml/loader.rb
ufo-6.1.0 lib/ufo/yaml/loader.rb
ufo-6.0.9 lib/ufo/yaml/loader.rb
ufo-6.0.8 lib/ufo/yaml/loader.rb
ufo-6.0.7 lib/ufo/yaml/loader.rb
ufo-6.0.6 lib/ufo/yaml/loader.rb
ufo-6.0.5 lib/ufo/yaml/loader.rb
ufo-6.0.4 lib/ufo/yaml/loader.rb
ufo-6.0.3 lib/ufo/yaml/loader.rb
ufo-6.0.2 lib/ufo/yaml/loader.rb
ufo-6.0.1 lib/ufo/yaml/loader.rb
ufo-6.0.0 lib/ufo/yaml/loader.rb