Sha256: d0dbd56e81ba7b0ec5be8736f51babb97f7eec7ca6b1d7acd02fc0b5da656e7d
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Ad module AgentArchitecture module Dsl # This class is responsible for defining the attributes of a workflow class AttributeDsl < ChildDsl attr_reader :current_attribute def attribute(name, type: :string, is_array: false, description: nil, &block) raise ArgumentError, 'Attribute name must be a string or symbol' unless name.is_a?(String) || name.is_a?(Symbol) @current_attribute = { name: name, type: type, is_array: is_array, description: description } attributes[name] = current_attribute instance_eval(&block) if block_given? self end def description(description) current_attribute[:description] = description self end def type(type) current_attribute[:type] = type self end def is_array(is_array) current_attribute[:is_array] = is_array self 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/attribute_dsl.rb |
ad-agent_architecture-0.0.23 | lib/ad/agent_architecture/dsl/attribute_dsl.rb |