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.3.13 lib/ufo/yaml/loader.rb
ufo-6.3.12 lib/ufo/yaml/loader.rb
ufo-6.3.11 lib/ufo/yaml/loader.rb
ufo-6.3.10 lib/ufo/yaml/loader.rb
ufo-6.3.9 lib/ufo/yaml/loader.rb
ufo-6.3.8 lib/ufo/yaml/loader.rb
ufo-6.3.7 lib/ufo/yaml/loader.rb
ufo-6.3.6 lib/ufo/yaml/loader.rb
ufo-6.3.5 lib/ufo/yaml/loader.rb
ufo-6.3.4 lib/ufo/yaml/loader.rb
ufo-6.3.3 lib/ufo/yaml/loader.rb
ufo-6.3.2 lib/ufo/yaml/loader.rb
ufo-6.3.1 lib/ufo/yaml/loader.rb
ufo-6.3.0 lib/ufo/yaml/loader.rb
ufo-6.2.5 lib/ufo/yaml/loader.rb
ufo-6.2.4 lib/ufo/yaml/loader.rb
ufo-6.2.3 lib/ufo/yaml/loader.rb
ufo-6.2.2 lib/ufo/yaml/loader.rb
ufo-6.2.1 lib/ufo/yaml/loader.rb
ufo-6.2.0 lib/ufo/yaml/loader.rb