Sha256: 0e1d2e69c7883355c02eed6b339deb0959ccef75708f12685bb91db231d4c7f2

Contents?: true

Size: 716 Bytes

Versions: 1

Compression:

Stored size: 716 Bytes

Contents

module Animal
  # As Animal is an ENC, this is the main class and entry point for Animal.
  class ENC
    def self.query(node_name, _opts = {})
      classifier  = Classifier.new(node_name)
      classes     = classifier.classes
      parameters  = classifier.parameters
      environment = classifier.environment
      results     = {}

      results['classes']     = classes if classes
      results['parameters']  = parameters if parameters
      results['environment'] = environment ? environment : 'production'

      to_enc_output results
    end

    def self.to_enc_output(data = {})
      return nil if data.empty? || (!data.key?('classes') && !data.key?('parameters'))
      data.to_yaml
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
animal-0.2.2 lib/animal/enc.rb