Sha256: 4d389344eef3d30f00870346bdd4cbe8860bc64b3c14c3d3bf0c8fee68773981

Contents?: true

Size: 775 Bytes

Versions: 8

Compression:

Stored size: 775 Bytes

Contents

module Dox
  module DSL
    class Documentation
      attr_accessor :subject
      attr_accessor :_resource
      attr_accessor :_action
      attr_accessor :_group

      def initialize(opts = {})
        self.subject = opts.fetch :subject
      end

      def resource(name, &block)
        self._resource = Resource.new(name, &block)
      end

      alias tag resource

      def action(name, &block)
        self._action = Action.new(name, &block)
      end

      def group(name, &block)
        self._group = ResourceGroup.new(name, &block)
      end

      alias x_tag group

      def config
        {}.merge(_resource ? _resource.config : {})
          .merge(_action ? _action.config : {})
          .merge(_group ? _group.config : {})
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dox-2.4.0 lib/dox/dsl/documentation.rb
dox-2.3.0 lib/dox/dsl/documentation.rb
dox-2.2.0 lib/dox/dsl/documentation.rb
dox-2.1.0 lib/dox/dsl/documentation.rb
dox-2.0.0 lib/dox/dsl/documentation.rb
dox-2.0.0.beta3 lib/dox/dsl/documentation.rb
dox-2.0.0.beta2 lib/dox/dsl/documentation.rb
dox-2.0.0.beta1 lib/dox/dsl/documentation.rb