Class: Remap::Rule

Inherits:
Dry::Interface
  • Object
show all
Includes:
Catchable
Defined in:
lib/remap/rule.rb,
lib/remap/rule/map.rb,
lib/remap/rule/void.rb,
lib/remap/rule/block.rb,
lib/remap/rule/map/enum.rb,
lib/remap/rule/map/optional.rb,
lib/remap/rule/map/required.rb

Defined Under Namespace

Classes: Block, Map, Void

Constant Summary collapse

VOID =
Void.new(EMPTY_HASH)

Instance Method Summary collapse

Methods included from Catchable

#catch_fatal, #catch_ignored

Instance Method Details

#call(state) ⇒ Object

This method is abstract.

Parameters:

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/remap/rule.rb', line 17

def call(state)
  raise NotImplementedError, "#{self.class}#call not implemented"
end

#inspectString Also known as: to_s

Returns:

  • (String)


22
23
24
# File 'lib/remap/rule.rb', line 22

def inspect
  "#<#{self.class} #{to_hash.formatted}>"
end

#to_hashHash

Returns:

  • (Hash)


28
29
30
# File 'lib/remap/rule.rb', line 28

def to_hash
  attributes.transform_values(&:to_hash).except(:backtrace)
end