Class: CheckWriter::Check
- Inherits:
-
Object
- Object
- CheckWriter::Check
- Includes:
- AttributeFormatting
- Defined in:
- lib/check_writer/check.rb
Overview
Check generates checks as a PDF
Constant Summary collapse
- STUB_FORMATS =
[:one_third, :two_thirds]
Instance Attribute Summary collapse
-
#account_number ⇒ Object
Returns the value of attribute account_number.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#bank_address ⇒ Object
Returns the value of attribute bank_address.
-
#bank_fraction ⇒ Object
Returns the value of attribute bank_fraction.
-
#bank_name ⇒ Object
Returns the value of attribute bank_name.
-
#blank ⇒ Object
Returns the value of attribute blank.
-
#date ⇒ Object
Returns the value of attribute date.
-
#memo ⇒ Object
Returns the value of attribute memo.
-
#number ⇒ Object
Returns the value of attribute number.
-
#payee_address ⇒ Object
Returns the value of attribute payee_address.
-
#payee_name ⇒ Object
Returns the value of attribute payee_name.
-
#payor_address ⇒ Object
Returns the value of attribute payor_address.
-
#payor_name ⇒ Object
Returns the value of attribute payor_name.
-
#routing_number ⇒ Object
Returns the value of attribute routing_number.
-
#second_signature_line ⇒ Object
Returns the value of attribute second_signature_line.
-
#signature_image_file ⇒ Object
Returns the value of attribute signature_image_file.
-
#stub_format ⇒ Object
Returns the value of attribute stub_format.
-
#stub_table_data ⇒ Object
Returns the value of attribute stub_table_data.
-
#stub_table_lambda ⇒ Object
Returns the value of attribute stub_table_lambda.
-
#stub_table_options ⇒ Object
Returns the value of attribute stub_table_options.
-
#void ⇒ Object
Returns the value of attribute void.
-
#with_stubs ⇒ Object
Returns the value of attribute with_stubs.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Check
constructor
A new instance of Check.
-
#to_pdf ⇒ Object
Renders the check as a pdf and returns the pdf data.
-
#to_prawn(pdf = nil) ⇒ Object
Renders the check and returns the Prawn::Document for further manipulation.
Methods included from AttributeFormatting
#amount_in_words, #cents, #dollars, #formatted_amount, #formatted_date
Constructor Details
#initialize(attributes = {}) ⇒ Check
Returns a new instance of Check.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/check_writer/check.rb', line 22 def initialize(attributes={}) attributes.reverse_merge!( :date => Date.today, :void => false, :blank => false, :with_stubs => false, :stub_table_data => [], :stub_table_options => {}, :stub_table_lambda => nil, :stub_format => :one_third ) _assign_attributes(attributes) end |
Instance Attribute Details
#account_number ⇒ Object
Returns the value of attribute account_number.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def account_number @account_number end |
#amount ⇒ Object
Returns the value of attribute amount.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def amount @amount end |
#bank_address ⇒ Object
Returns the value of attribute bank_address.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def bank_address @bank_address end |
#bank_fraction ⇒ Object
Returns the value of attribute bank_fraction.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def bank_fraction @bank_fraction end |
#bank_name ⇒ Object
Returns the value of attribute bank_name.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def bank_name @bank_name end |
#blank ⇒ Object
Returns the value of attribute blank.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def blank @blank end |
#date ⇒ Object
Returns the value of attribute date.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def date @date end |
#memo ⇒ Object
Returns the value of attribute memo.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def memo @memo end |
#number ⇒ Object
Returns the value of attribute number.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def number @number end |
#payee_address ⇒ Object
Returns the value of attribute payee_address.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def payee_address @payee_address end |
#payee_name ⇒ Object
Returns the value of attribute payee_name.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def payee_name @payee_name end |
#payor_address ⇒ Object
Returns the value of attribute payor_address.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def payor_address @payor_address end |
#payor_name ⇒ Object
Returns the value of attribute payor_name.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def payor_name @payor_name end |
#routing_number ⇒ Object
Returns the value of attribute routing_number.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def routing_number @routing_number end |
#second_signature_line ⇒ Object
Returns the value of attribute second_signature_line.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def second_signature_line @second_signature_line end |
#signature_image_file ⇒ Object
Returns the value of attribute signature_image_file.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def signature_image_file @signature_image_file end |
#stub_format ⇒ Object
Returns the value of attribute stub_format.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def stub_format @stub_format end |
#stub_table_data ⇒ Object
Returns the value of attribute stub_table_data.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def stub_table_data @stub_table_data end |
#stub_table_lambda ⇒ Object
Returns the value of attribute stub_table_lambda.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def stub_table_lambda @stub_table_lambda end |
#stub_table_options ⇒ Object
Returns the value of attribute stub_table_options.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def @stub_table_options end |
#void ⇒ Object
Returns the value of attribute void.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def void @void end |
#with_stubs ⇒ Object
Returns the value of attribute with_stubs.
10 11 12 |
# File 'lib/check_writer/check.rb', line 10 def with_stubs @with_stubs end |
Instance Method Details
#to_pdf ⇒ Object
Renders the check as a pdf and returns the pdf data
38 39 40 |
# File 'lib/check_writer/check.rb', line 38 def to_pdf to_prawn.render end |
#to_prawn(pdf = nil) ⇒ Object
Renders the check and returns the Prawn::Document for further manipulation.
To use an existing Prawn::Document, pass this in as the pdf
argument. If pdf
is nil, a new Prawn::Document will be created.
48 49 50 51 52 |
# File 'lib/check_writer/check.rb', line 48 def to_prawn(pdf=nil) @pdf = pdf||Prawn::Document.new(:bottom_margin => 0.0) _generate_check_pdf @pdf end |