Sha256: 374683434c501d00e7059e3bfa5f2510eb97300b5c59b4f6fb36be7a79f39c7c

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 Bytes

Contents

# frozen_string_literal: true

module Ad
  module AgentArchitecture
    module Dsl
      # Helper methods for accessing data in the workflow DSL
      module DataAccessors
        def settings
          data[:settings]
        end

        def sections
          data[:sections]
        end

        def get_setting(name)
          settings[name.to_sym] || settings[name.to_s]
        end

        def setting_value(name, default: nil)
          lookup = get_setting(name)
          lookup ? lookup[:value] : default
        end

        def attributes
          data[:attributes]
        end

        def get_attribute(name)
          attributes[name.to_sym] || attributes[name.to_s]
        end

        def prompts
          data[:prompts]
        end

        def get_prompt(name)
          prompts[name.to_sym] || prompts[name.to_s]
        end

        def prompt_content(name, default: nil)
          lookup = get_prompt(name)
          lookup ? lookup[:content] : default
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ad-agent_architecture-0.0.24 lib/ad/agent_architecture/dsl/data_accessors.rb
ad-agent_architecture-0.0.23 lib/ad/agent_architecture/dsl/data_accessors.rb