Class: Boba::Options::AssociationTypeOption

Inherits:
T::Enum
  • Object
show all
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

: ( | Hash[String, untyped] options | ) { (String value, AssociationTypeOption default_association_type_option) -> void } -> AssociationTypeOption



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/boba/options/association_type_option.rb', line 16

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

: -> bool

Returns:

  • (Boolean)


38
39
40
# File 'lib/boba/options/association_type_option.rb', line 38

def nilable?
  self == AssociationTypeOption::Nilable
end

#persisted?Boolean

: -> bool

Returns:

  • (Boolean)


33
34
35
# File 'lib/boba/options/association_type_option.rb', line 33

def persisted?
  self == AssociationTypeOption::Persisted
end