Class: Boletoman::Builders::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/boletoman/builders/base.rb

Direct Known Subclasses

Itau, Santander

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



9
10
11
# File 'lib/boletoman/builders/base.rb', line 9

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

Class Method Details

.generatorObject



21
22
23
# File 'lib/boletoman/builders/base.rb', line 21

def self.generator
  to_s.demodulize.downcase
end

Instance Method Details

#buildObject



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

def build
  ::Boletoman::Boleto.new(instance)
end

#duplicate?Boolean

segunda via

Returns:

  • (Boolean)


30
31
32
# File 'lib/boletoman/builders/base.rb', line 30

def duplicate?
  data.dig(:boleto, :duplicate) == true
end

#formatterObject



25
26
27
# File 'lib/boletoman/builders/base.rb', line 25

def formatter
  @formatter ||= Formatter.new(data)
end

#instanceObject

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/boletoman/builders/base.rb', line 17

def instance
  raise NotImplementedError
end