Sha256: 02bafa40f315c73245b008e5e2ee125d5f169ac6f66e0542a2cdd3ac4409af7a

Contents?: true

Size: 684 Bytes

Versions: 4

Compression:

Stored size: 684 Bytes

Contents

module Dox
  module DSL
    class Resource
      include AttrProxy

      attr_writer :name
      attr_writer :group
      attr_writer :endpoint

      attr_writer :desc

      def initialize(name, &block)
        self.name = name

        instance_eval(&block)

        raise(Dox::Errors::InvalidResourceError, 'Resource name is required!') if @name.blank?
        raise(Dox::Errors::InvalidResourceError, 'Resource group is required!') if @group.blank?
      end

      def config
        {
          resource_name: @name.presence,
          resource_desc: @desc.presence,
          resource_group_name: @group.presence,
          apidoc: true
        }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dox-2.3.0 lib/dox/dsl/resource.rb
dox-2.2.0 lib/dox/dsl/resource.rb
dox-2.1.0 lib/dox/dsl/resource.rb
dox-2.0.0 lib/dox/dsl/resource.rb