Class: Rails::Schema::Transformer::Edge

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/schema/transformer/edge.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from:, to:, association_type:, label:, foreign_key: nil, through: nil, polymorphic: false) ⇒ Edge

Returns a new instance of Edge.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rails/schema/transformer/edge.rb', line 10

def initialize(from:, to:, association_type:, label:, foreign_key: nil, through: nil, polymorphic: false)
  @from = from
  @to = to
  @association_type = association_type
  @label = label
  @foreign_key = foreign_key
  @through = through
  @polymorphic = polymorphic
  @reverse_label = nil
  @reverse_association_type = nil
end

Instance Attribute Details

#association_typeObject (readonly)

Returns the value of attribute association_type.



7
8
9
# File 'lib/rails/schema/transformer/edge.rb', line 7

def association_type
  @association_type
end

#foreign_keyObject (readonly)

Returns the value of attribute foreign_key.



7
8
9
# File 'lib/rails/schema/transformer/edge.rb', line 7

def foreign_key
  @foreign_key
end

#fromObject (readonly)

Returns the value of attribute from.



7
8
9
# File 'lib/rails/schema/transformer/edge.rb', line 7

def from
  @from
end

#labelObject (readonly)

Returns the value of attribute label.



7
8
9
# File 'lib/rails/schema/transformer/edge.rb', line 7

def label
  @label
end

#polymorphicObject (readonly)

Returns the value of attribute polymorphic.



7
8
9
# File 'lib/rails/schema/transformer/edge.rb', line 7

def polymorphic
  @polymorphic
end

#reverse_association_typeObject

Returns the value of attribute reverse_association_type.



8
9
10
# File 'lib/rails/schema/transformer/edge.rb', line 8

def reverse_association_type
  @reverse_association_type
end

#reverse_labelObject

Returns the value of attribute reverse_label.



8
9
10
# File 'lib/rails/schema/transformer/edge.rb', line 8

def reverse_label
  @reverse_label
end

#throughObject (readonly)

Returns the value of attribute through.



7
8
9
# File 'lib/rails/schema/transformer/edge.rb', line 7

def through
  @through
end

#toObject (readonly)

Returns the value of attribute to.



7
8
9
# File 'lib/rails/schema/transformer/edge.rb', line 7

def to
  @to
end

Instance Method Details

#to_hObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rails/schema/transformer/edge.rb', line 22

def to_h
  {
    from: @from,
    to: @to,
    association_type: @association_type,
    label: @label,
    foreign_key: @foreign_key,
    through: @through,
    polymorphic: @polymorphic,
    reverse_label: @reverse_label,
    reverse_association_type: @reverse_association_type
  }
end