Class: Restspec::Schema::Types::BasicType

Inherits:
Object
  • Object
show all
Defined in:
lib/restspec/schema/types/basic_type.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BasicType

Returns a new instance of BasicType.



2
3
4
# File 'lib/restspec/schema/types/basic_type.rb', line 2

def initialize(options = {})
  self.options = options
end

Instance Method Details

#of(other_type) ⇒ Object



11
12
13
14
# File 'lib/restspec/schema/types/basic_type.rb', line 11

def of(other_type)
  self.parameterized_type = other_type
  self
end

#totally_valid?(attribute, value) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
# File 'lib/restspec/schema/types/basic_type.rb', line 16

def totally_valid?(attribute, value)
  if disjuction.present?
    valid?(attribute, value) || disjuction.valid?(attribute, value)
  else
    valid?(attribute, value)
  end
end

#|(other_type) ⇒ Object



6
7
8
9
# File 'lib/restspec/schema/types/basic_type.rb', line 6

def |(other_type)
  self.disjuction = other_type
  self
end