Exception: Erlash::Base

Inherits:
StandardError
  • Object
show all
Defined in:
lib/erlash/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input = nil, opts = {}) ⇒ Base

Returns a new instance of Base.



22
23
24
25
26
27
# File 'lib/erlash/base.rb', line 22

def initialize(input = nil, opts = {})
  @input = input
  @opts = default_opts.merge(opts)
  set_formatter
  super(formatter.to_s)
end

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



20
21
22
# File 'lib/erlash/base.rb', line 20

def input
  @input
end

#optsObject (readonly)

Returns the value of attribute opts.



20
21
22
# File 'lib/erlash/base.rb', line 20

def opts
  @opts
end

Class Method Details

._display_contextObject



16
17
18
# File 'lib/erlash/base.rb', line 16

def _display_context
  defined?(@display_context) ? @display_context : true
end

.display_context(arg) ⇒ Object



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

def display_context(arg)
  @display_context = arg
end

.problem(arg = nil, &block) ⇒ Object



4
5
6
# File 'lib/erlash/base.rb', line 4

def problem(arg = nil, &block)
  @problem = block || arg
end

.resolution(arg = nil, &block) ⇒ Object



10
11
12
# File 'lib/erlash/base.rb', line 10

def resolution(arg = nil, &block)
  @resolution = block || arg
end

.summary(arg = nil, &block) ⇒ Object



7
8
9
# File 'lib/erlash/base.rb', line 7

def summary(arg = nil, &block)
  @summary = block || arg
end

Instance Method Details

#hints?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/erlash/base.rb', line 39

def hints?
  !!(problem || summary || resolution)
end

#problemObject



29
30
31
# File 'lib/erlash/base.rb', line 29

def problem
  @problem ||= exec_config(self.class.instance_variable_get(:@problem))
end

#resolutionObject



35
36
37
# File 'lib/erlash/base.rb', line 35

def resolution
  @resolution ||= exec_config(self.class.instance_variable_get(:@resolution))
end

#summaryObject



32
33
34
# File 'lib/erlash/base.rb', line 32

def summary
  @summary ||= exec_config(self.class.instance_variable_get(:@summary))
end