Class: L43Peg::Failure

Inherits:
Object
  • Object
show all
Extended by:
L43::OpenObject
Defined in:
lib/l43_peg/failure.rb

Instance Method Summary collapse

Instance Method Details

#deconstructObject



8
# File 'lib/l43_peg/failure.rb', line 8

def deconstruct(*) = [:error, named_reason]

#map(name:, reason:) ⇒ Object



10
11
12
13
# File 'lib/l43_peg/failure.rb', line 10

def map(name:, reason:)
  update_attribute(:reason, reason)
    .update_attribute_if(:name, name)
end

#named_reasonObject



15
16
17
18
19
20
21
# File 'lib/l43_peg/failure.rb', line 15

def named_reason
  if name
    "#{reason} (in #{name})"
  else
    reason
  end
end

#position_hrObject



23
# File 'lib/l43_peg/failure.rb', line 23

def position_hr = "@#{position}"