Class: Koi::Helpers::AttributeHelpers::IntrospectedAttribute

Inherits:
Rails::Generators::GeneratedAttribute
  • Object
show all
Defined in:
lib/generators/koi/helpers/attribute_helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, association: nil, attachment: nil, enum: nil) ⇒ IntrospectedAttribute

Returns a new instance of IntrospectedAttribute.



27
28
29
30
31
32
33
# File 'lib/generators/koi/helpers/attribute_helpers.rb', line 27

def initialize(name, type, association: nil, attachment: nil, enum: nil, **)
  super(name, type, **)

  @association = association
  @attachment = attachment
  @enum = enum
end

Instance Attribute Details

#associationObject (readonly)

Returns the value of attribute association.



25
26
27
# File 'lib/generators/koi/helpers/attribute_helpers.rb', line 25

def association
  @association
end

#attachmentObject (readonly)

Returns the value of attribute attachment.



25
26
27
# File 'lib/generators/koi/helpers/attribute_helpers.rb', line 25

def attachment
  @attachment
end

#enumObject (readonly)

Returns the value of attribute enum.



25
26
27
# File 'lib/generators/koi/helpers/attribute_helpers.rb', line 25

def enum
  @enum
end

Instance Method Details

#association?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/generators/koi/helpers/attribute_helpers.rb', line 35

def association?
  @association.present?
end

#attachment?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/generators/koi/helpers/attribute_helpers.rb', line 39

def attachment?
  @attachment.present?
end

#enum?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/generators/koi/helpers/attribute_helpers.rb', line 43

def enum?
  @enum.present?
end