Sha256: 5528973b4ce48988f043b314c0837fa0dfe5abb413ee76901c00ee25e97dd0c4

Contents?: true

Size: 596 Bytes

Versions: 7

Compression:

Stored size: 596 Bytes

Contents

module SoberSwag
  class OutputObject
    ##
    # Container to define a single output object.
    # This is the DSL used in the base of {SoberSwag::OutputObject.define}.
    class Definition
      def initialize
        @fields = []
        @views = []
      end

      attr_reader :fields, :views

      include FieldSyntax

      def add_field!(field)
        @fields << field
      end

      def view(name, &block)
        @views << View.define(name, fields, &block)
      end

      def identifier(arg = nil)
        @identifier = arg if arg
        @identifier
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sober_swag-0.8.0 lib/sober_swag/output_object/definition.rb
sober_swag-0.7.0 lib/sober_swag/output_object/definition.rb
sober_swag-0.6.0 lib/sober_swag/output_object/definition.rb
sober_swag-0.5.0 lib/sober_swag/output_object/definition.rb
sober_swag-0.4.0 lib/sober_swag/output_object/definition.rb
sober_swag-0.3.0 lib/sober_swag/output_object/definition.rb
sober_swag-0.2.0 lib/sober_swag/output_object/definition.rb