class Apigen::ObjectProperty

ObjectProperty is a specific property in an ObjectType.

Attributes

required[W]
type[R]

Public Class Methods

new(type, description = nil, example = nil) click to toggle source
# File lib/apigen/models/object_property.rb, line 14
def initialize(type, description = nil, example = nil)
  @type = type
  @description = description
  @example = example
  @required = true
end

Public Instance Methods

==(other) click to toggle source
# File lib/apigen/models/object_property.rb, line 35
def ==(other)
  other.is_a?(ObjectProperty) && type == other.type && required? == other.required? && description == other.description && example == other.example
end
explain(&block) click to toggle source
# File lib/apigen/models/object_property.rb, line 30
def explain(&block)
  raise 'You must pass a block to `explain`.' unless block_given?
  instance_eval(&block)
end
required(required) click to toggle source
# File lib/apigen/models/object_property.rb, line 21
def required(required)
  @required = required
  self
end
required?() click to toggle source
# File lib/apigen/models/object_property.rb, line 26
def required?
  @required
end