Sha256: 481d2d72ce5fba914455361bd27615d7e1b228c02500655c2a3abdb7fc9e75ec

Contents?: true

Size: 775 Bytes

Versions: 9

Compression:

Stored size: 775 Bytes

Contents

module Dox
  module Printers
    class ResourcePrinter < BasePrinter
      def print(resource)
        self.resource = resource
        add_resources

        resource.actions.each do |_, action|
          action_printer.print(action)
        end
      end

      private

      attr_accessor :resource

      def add_resources
        add_to_tags
        add_to_groups
      end

      def add_to_tags
        spec['tags'] = spec['tags'].push(name: resource.name, description: format_desc(resource.desc)).uniq
      end

      def add_to_groups
        spec['x-tagGroups'].find { |group| group[:name] == resource.group }['tags'].push(resource.name)
      end

      def action_printer
        @action_printer ||= ActionPrinter.new(spec['paths'])
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dox-2.5.0 lib/dox/printers/resource_printer.rb
dox-2.4.0 lib/dox/printers/resource_printer.rb
dox-2.3.0 lib/dox/printers/resource_printer.rb
dox-2.2.0 lib/dox/printers/resource_printer.rb
dox-2.1.0 lib/dox/printers/resource_printer.rb
dox-2.0.0 lib/dox/printers/resource_printer.rb
dox-2.0.0.beta3 lib/dox/printers/resource_printer.rb
dox-2.0.0.beta2 lib/dox/printers/resource_printer.rb
dox-2.0.0.beta1 lib/dox/printers/resource_printer.rb