Sha256: 2c3ec5d9bcd3db88b9346d0ac9709867e939932be0d13ca99af62a015fc6c657

Contents?: true

Size: 732 Bytes

Versions: 2

Compression:

Stored size: 732 Bytes

Contents

module Dox
  module DSL
    class Resource
      include AttrProxy

      attr_writer :name
      attr_writer :group
      attr_writer :desc
      attr_writer :endpoint

      def initialize(opts = {})
        self.name = opts.fetch(:name, nil)
        self.desc = opts.fetch(:desc, nil)
        self.group = opts.fetch(:group, nil)
        self.endpoint = opts.fetch(:endpoint, nil)
      end

      def config
        {}.tap do |config|
          config[:resource_name] = @name if @name
          config[:resource_desc] = @desc if @desc
          config[:resource_group_name] = @group if @group
          config[:resource_endpoint] = @endpoint if @endpoint
          config[:apidoc] = true
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dox-0.0.3 lib/dox/dsl/resource.rb
dox-0.0.2 lib/dox/dsl/resource.rb