Intrepidd / working_hours

⏰ A modern ruby gem allowing to do time calculation with business / working hours.
https://github.com/Intrepidd/working_hours
MIT License
533 stars 30 forks source link

Config refactoring #12

Closed Intrepidd closed 9 years ago

Intrepidd commented 9 years ago

WIP, do not merge yet

Here i'll implement changes proposed in #8, starting now with some more robust validations.

More coming soon

Intrepidd commented 9 years ago

Mandatory cute kitty lolcommit

b2946ed4e31

Intrepidd commented 9 years ago

I implemented with_config, any thoughts ?

jarthod commented 9 years ago

Good, but I think it would be better with keyword arguments:

def with_config working_hours: self.working_hours, holidays: self.holydays, time_zone: self.timezone
end

So we can override only one of the 3 attributes:

with_config(working_hours: {mon: {'08:00' => '17:00'}}) do
end

And even pass a single hash with the 3 parameters.

with_config(JSON.parse(File.read("config.json"))) do
end
Intrepidd commented 9 years ago

Yes good idea, will do !

On Sun Dec 07 2014 at 4:38:27 PM Adrien Jarthon notifications@github.com wrote:

Good, but I think it would be better with keyword arguments:

def with_config working_hours: self.working_hours, holidays: self.holydays, time_zone: self.timezoneend

So we can override only one of the 3 attributes:

with_config(working_hours: {mon: {'08:00' => '17:00'}}) doend

And even pass a single hash with the 3 parameters.

with_config(JSON.parse(File.read("config.json"))) doend

— Reply to this email directly or view it on GitHub https://github.com/Intrepidd/working_hours/pull/12#issuecomment-65941121 .

jarthod commented 9 years ago

Seems good to me :) shall we merge ?

Intrepidd commented 9 years ago

Let's do this :)

On Sun, Dec 28, 2014, 09:47 Adrien Jarthon notifications@github.com wrote:

Seems good to me :) shall we merge ?

— Reply to this email directly or view it on GitHub https://github.com/Intrepidd/working_hours/pull/12#issuecomment-68201671 .