Class: BlockKit::Fixers::Base

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Callbacks
Defined in:
lib/block_kit/fixers/base.rb

Direct Known Subclasses

Associated, NullValue, Truncate

Instance Method Summary collapse

Constructor Details

#initialize(attribute:, **options) ⇒ Base

Returns a new instance of Base.



8
9
10
11
# File 'lib/block_kit/fixers/base.rb', line 8

def initialize(attribute:, **options)
  @attribute = attribute.to_sym
  @dangerous = options.delete(:dangerous)
end

Instance Method Details

#dangerous?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/block_kit/fixers/base.rb', line 17

def dangerous?
  !!@dangerous
end

#fix(model, fixing_dangerously: false) ⇒ Object

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/block_kit/fixers/base.rb', line 13

def fix(model, fixing_dangerously: false)
  raise NotImplementedError, "#{self.class} must implement `fix'"
end