Class: SunatBooks::Ple::Base
- Inherits:
-
Object
- Object
- SunatBooks::Ple::Base
- Includes:
- CommonUtils, Utils
- Defined in:
- lib/sunat_books/ple/base.rb
Instance Attribute Summary collapse
-
#book_format ⇒ Object
readonly
Returns the value of attribute book_format.
-
#file ⇒ Object
Returns the value of attribute file.
Instance Method Summary collapse
-
#initialize(ruc, tickets, month, year, options = {}) ⇒ Base
constructor
ruc => company’s ruc in string format tickets => an array of objects that respond to a layout’s methods month => a number that represent a month year => a number that represent a year options => :yml => to define a custom layout file :layout => to define a custom name for a specific layout method :book_format => to define ple book format to use.
Methods included from Utils
#book_code, #check_layout, #get_file, #get_value, #path, #ple_book_name
Methods included from CommonUtils
Constructor Details
#initialize(ruc, tickets, month, year, options = {}) ⇒ Base
ruc => company’s ruc in string format tickets => an array of objects that respond to a layout’s methods month => a number that represent a month year => a number that represent a year options =>
:yml => to define a custom layout file
:layout => to define a custom name for a specific layout method
:book_format => to define ple book format to use
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sunat_books/ple/base.rb', line 24 def initialize(ruc, tickets, month, year, = {}) @book_format = [:book_format] yml_path = [:yml] || default_yml(book_format) raise SunatBooks::Errors::InvalidLayoutError unless File.exist?(yml_path) fields = YAML.load_file(yml_path) check_layout(, fields) content = !tickets.empty? ? 1 : 0 name = ple_book_name(book_format, ruc, month, year, nil, content) filename = "#{path}#{name}.txt" get_file(tickets, fields, filename) end |
Instance Attribute Details
#book_format ⇒ Object (readonly)
Returns the value of attribute book_format.
14 15 16 |
# File 'lib/sunat_books/ple/base.rb', line 14 def book_format @book_format end |
#file ⇒ Object
Returns the value of attribute file.
13 14 15 |
# File 'lib/sunat_books/ple/base.rb', line 13 def file @file end |