Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make execution date configurable #9

Open
mulderp opened this issue Mar 20, 2013 · 4 comments
Open

Make execution date configurable #9

mulderp opened this issue Mar 20, 2013 · 4 comments

Comments

@mulderp
Copy link

mulderp commented Mar 20, 2013

Hello,

we are having a use case where the creation date is different from the execution date.

I have already a fix to use a variable for this:

https://github.com/salesking/king_dtaus/blob/master/lib/king_dta/dtaus.rb#L80

 data += '%8s' % @execution_date.strftime("%d%m%Y")

If you want I can issue a PR.

Thanks for your attention!

Patrick

@schorsch
Copy link
Member

of course i'll implement it. maybe also add a fallback like:

 (@execution_date || @date).strftime("%d%m%Y")

@mulderp
Copy link
Author

mulderp commented Mar 20, 2013

Yes, good idea.

Hmm.. now, I remember again, why I did this PR not earler, I had changed the constructor to take an options hash, where I set the execution date: mulderp@7d821ff

this would actually break the interface, so, maybe you have a better idea. Anyway, let me know if you find this useful, or what I could change.

@schorsch
Copy link
Member

How about this initializer:

def initialize( args={} )

if args.is_a? hash
 @date = args[:date] || Date.today
 @execution_date =  args[:execute-date] ||  @date
else # maybe elsif with Date / Datetime check
 @date = args
end

Only make sense if there are more args to come, else i would go for two default args instead of a hash

@mulderp
Copy link
Author

mulderp commented Mar 21, 2013

Nice one. Actually, I was thinking that I could set attributes like in your approach to set the owner_name, bank_account_number, etc.

However, having an options hash to initialize the 'A-Satz' during object creation might be interesting too. It's the values from the A-Satz that would define the arguments list of the constructor http://de.wikipedia.org/wiki/Datentr%C3%A4geraustauschverfahren#A-Satz

OK, I update my branch later today with the ducktyping approach, and let's see... :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants