Class: Spectifly::Base::Association

Inherits:
EntityNode show all
Defined in:
lib/spectifly/base/association.rb

Direct Known Subclasses

Json::Association, Xsd::Association

Instance Attribute Summary collapse

Attributes inherited from EntityNode

#attributes, #description, #example, #inherits_from, #name, #restrictions, #validations

Instance Method Summary collapse

Methods inherited from EntityNode

#display_type, #extract_attributes, #extract_restrictions, #required?, #type, #unique?

Constructor Details

#initialize(field_name, options = {}) ⇒ Association

Returns a new instance of Association.



8
9
10
11
# File 'lib/spectifly/base/association.rb', line 8

def initialize(field_name, options = {})
  super
  @relationship = options.delete(:relationship)
end

Instance Attribute Details

#relationshipObject (readonly)

Returns the value of attribute relationship.



6
7
8
# File 'lib/spectifly/base/association.rb', line 6

def relationship
  @relationship
end

Instance Method Details

#multiple?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/spectifly/base/association.rb', line 13

def multiple?
  ['has_many', 'has_many_and_belongs_to', 'belongs_to_many'].include? relationship
end