Class: Boba::Options::AssociationTypeOption

Inherits:
T::Enum
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/boba/options/association_type_option.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_options(options, &block) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/boba/options/association_type_option.rb', line 23

def from_options(options, &block)
  association_type_option = Nilable
  value = options["ActiveRecordAssociationTypes"]

  if value
    if has_serialized?(value)
      association_type_option = from_serialized(value)
    else
      block.call(value, association_type_option)
    end
  end

  association_type_option
end

Instance Method Details

#nilable?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/boba/options/association_type_option.rb', line 45

def nilable?
  self == AssociationTypeOption::Nilable
end

#persisted?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/boba/options/association_type_option.rb', line 40

def persisted?
  self == AssociationTypeOption::Persisted
end