Last active
October 19, 2019 12:40
-
-
Save victorgiraldes/354b0fc7180da4587ef8e061c3457e34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EntryBuilder | |
def self.build | |
builder = new | |
yield(builder) | |
builder.entry | |
end | |
def initialize | |
@entry = Entry.new | |
end | |
def set_user(user) | |
@entry.user | |
end | |
def set_company(company) | |
@entry.company | |
end | |
def set_provider(provider) | |
@entry.provider | |
end | |
def set_year_company | |
@entry.provider | |
end | |
def set_date(date) | |
@entry.date | |
end | |
def set_invoce(invoce) | |
@entry.invoce | |
end | |
def set_value(value) | |
@entry.value | |
end | |
def set_discount(discount) | |
@entry.discount | |
end | |
def set_entry_inputs(input, amount, amount_entry, kind, unit, lot, validity, value) | |
@entry.entry_inputs.input | |
@entry.entry_inputs.amount | |
@entry.entry_inputs.amount_entry | |
@entry.entry_inputs.kind | |
@entry.entry_inputs.unit | |
@entry.entry_inputs.lot | |
@entry.entry_inputs.validity | |
@entry.entry_inputs.value | |
end | |
def entry | |
@entry | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment