Class: Infold::ShowElement

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/infold/property/show_element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, **attrs) ⇒ ShowElement

Returns a new instance of ShowElement.



11
12
13
14
15
# File 'lib/infold/property/show_element.rb', line 11

def initialize(field, **attrs)
  @field = field
  @association_fields = []
  super(**attrs)
end

Instance Attribute Details

#associationObject

Returns the value of attribute association.



8
9
10
# File 'lib/infold/property/show_element.rb', line 8

def association
  @association
end

#association_fieldsObject (readonly)

Returns the value of attribute association_fields.



5
6
7
# File 'lib/infold/property/show_element.rb', line 5

def association_fields
  @association_fields
end

#fieldObject (readonly)

Returns the value of attribute field.



5
6
7
# File 'lib/infold/property/show_element.rb', line 5

def field
  @field
end

#seqObject

Returns the value of attribute seq.



8
9
10
# File 'lib/infold/property/show_element.rb', line 8

def seq
  @seq
end

Instance Method Details

#add_association_fields(field, **attrs) ⇒ Object



17
18
19
20
# File 'lib/infold/property/show_element.rb', line 17

def add_association_fields(field, **attrs)
  field.build_show_element(**attrs)
  @association_fields << field
end

#kind_association?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/infold/property/show_element.rb', line 22

def kind_association?
  field.association.present?
end