Class: Oso::Polar::DataFiltering::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/oso/polar/data_filtering.rb

Overview

Represents relationships between resources, eg. one-one or one-many

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, other_type:, my_field:, other_field:) ⇒ Relation

Describe a Relation from one type to another.

Parameters:

  • kind (String)

    The type of relation, either “one” or “many”

  • other_type

    The name or class object of the related type

  • my_field

    The field on this type that matches other_type

  • other_field

    The field on other_type that matches this type



16
17
18
19
20
21
# File 'lib/oso/polar/data_filtering.rb', line 16

def initialize(kind:, other_type:, my_field:, other_field:)
  @kind = kind
  @other_type = other_type
  @my_field = my_field
  @other_field = other_field
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



9
10
11
# File 'lib/oso/polar/data_filtering.rb', line 9

def kind
  @kind
end

#my_fieldObject (readonly)

Returns the value of attribute my_field.



9
10
11
# File 'lib/oso/polar/data_filtering.rb', line 9

def my_field
  @my_field
end

#other_fieldObject (readonly)

Returns the value of attribute other_field.



9
10
11
# File 'lib/oso/polar/data_filtering.rb', line 9

def other_field
  @other_field
end

#other_typeObject (readonly)

Returns the value of attribute other_type.



9
10
11
# File 'lib/oso/polar/data_filtering.rb', line 9

def other_type
  @other_type
end