Class: Servactory::Maintenance::Attributes::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/servactory/maintenance/attributes/option.rb

Overview

rubocop:disable Metrics/ClassLength

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, attribute:, validation_class:, need_for_checks:, body_fallback:, original_value: nil, body_key: nil, body_value: true, define_methods: nil, define_conflicts: nil, with_advanced_mode: true, **options) ⇒ Option

rubocop:disable Metrics/MethodLength



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/servactory/maintenance/attributes/option.rb', line 19

def initialize(
  name:,
  attribute:,
  validation_class:,
  need_for_checks:,
  body_fallback:,
  original_value: nil,
  body_key: nil,
  body_value: true,
  define_methods: nil,
  define_conflicts: nil,
  with_advanced_mode: true,
  **options
)
  @name = name.to_sym
  @validation_class = validation_class
  @define_methods = define_methods
  @define_conflicts = define_conflicts
  @need_for_checks = need_for_checks

  @body = construct_body(
    original_value:,
    options:,
    body_key:,
    body_value:,
    body_fallback:,
    with_advanced_mode:
  )

  apply_dynamic_methods_to(attribute:)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



11
12
13
# File 'lib/servactory/maintenance/attributes/option.rb', line 11

def body
  @body
end

#define_conflictsObject (readonly)

Returns the value of attribute define_conflicts.



11
12
13
# File 'lib/servactory/maintenance/attributes/option.rb', line 11

def define_conflicts
  @define_conflicts
end

#define_methodsObject (readonly)

Returns the value of attribute define_methods.



11
12
13
# File 'lib/servactory/maintenance/attributes/option.rb', line 11

def define_methods
  @define_methods
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/servactory/maintenance/attributes/option.rb', line 11

def name
  @name
end

#need_for_checksObject (readonly)

Returns the value of attribute need_for_checks.



11
12
13
# File 'lib/servactory/maintenance/attributes/option.rb', line 11

def need_for_checks
  @need_for_checks
end

#validation_classObject (readonly)

Returns the value of attribute validation_class.



11
12
13
# File 'lib/servactory/maintenance/attributes/option.rb', line 11

def validation_class
  @validation_class
end

Instance Method Details

#need_for_checks?Boolean

rubocop:enable Metrics/MethodLength

Returns:

  • (Boolean)


52
53
54
# File 'lib/servactory/maintenance/attributes/option.rb', line 52

def need_for_checks?
  need_for_checks
end