class ApiSketch::DSL::Attributes

Constants

TYPES

Public Class Methods

build_by(data_type, attribute_name, &block) click to toggle source
# File lib/api_sketch/dsl/attributes.rb, line 33
def build_by(data_type, attribute_name, &block)
  options = {data_type: data_type}
  options[:name] = attribute_name if attribute_name
  case data_type
  when :document, :array
    ::ApiSketch::Model::Attribute.new(::ApiSketch::DSL::ComplexAttributeParser.new(data_type, &block).to_h.merge(options))
  else
    ::ApiSketch::Model::Attribute.new(::ApiSketch::DSL::AttributeParser.new(data_type, &block).to_h.merge(options))
  end
end
new(container_type, &block) click to toggle source
# File lib/api_sketch/dsl/attributes.rb, line 5
def initialize(container_type, &block)
  @container_type = container_type
  @params = []
  define_singleton_method(:initialize_attributes, block)
  initialize_attributes
end

Public Instance Methods

to_a() click to toggle source
# File lib/api_sketch/dsl/attributes.rb, line 12
def to_a
  @params
end