Comments (7)
Could you provide specific examples with expected output?
At first glance, I'm not sure if this is something that needs to or should live in the gem itself.
from biz.
It might be too specific.
It could be nice if TimeSegment had some kind of interval API :
- intersection (overlapping).
- union (it might be tricky for none overlapping segments).
- contains (an other segment).
Le 3 avr. 2016 21:13, "Craig Little" [email protected] a écrit :
Could you provide specific examples with expected output?
At first glance, I'm not sure if this is something that needs to or should
live in the gem itself.—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#54 (comment)
from biz.
Two out of the three already exist on TimeSegment
. The only one that doesn't is the tricky union
.
Does that address your use case?
from biz.
The contains?
seems to take a Time and not a TimeSegment.
2016-04-05 2:39 GMT+02:00 Craig Little [email protected]:
Two out of the three already exist on TimeSegment
.Lines 34 to 43 in e05502f
The only one that doesn't is the tricky union.Does that address your use case?
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#54 (comment)
Thomas Pocreau
Recherche & Développement | Colisweb
[email protected]
06 45 12 61 58
Euratechnologies | 165, Avenue de Bretagne
59000 - Lille
from biz.
How about doing something like:
ts1.endpoints.all? { |endpoint| ts2.contains?(endpoint) }
from biz.
Yes, I did it this way but contains? is error prone since it returns false
when you pass a TimeSegment.
Thanks a lot for your feedback :-)
Le 5 avr. 2016 09:49, "Craig Little" [email protected] a écrit :
How about doing something like:
ts1.endpoints.all? { |endpoint| ts2.contains?(endpoint) }
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#54 (comment)
from biz.
No problem! Yeah, unfortunately, that's sort of the nature of weakly typed languages like Ruby. Without adding a bunch of type checks everywhere, one must understand what the method expects to receive. At least it didn't return true every time, eh? :)
I'll definitely keep this use case in mind in case I hear similar needs from other users, but I'm going to close the issue for now. Thanks for putting the gem through its paces! Please let me know if you run into anything else.
from biz.
Related Issues (20)
- Question: equivalent of working_hours #advance_to_working_time ? HOT 2
- Specify extra working periods HOT 2
- NoMethodError: undefined method `on' for #<Biz::Periods::Proxy:0x007f9b164d5d10> HOT 3
- Find the next busniess day during work hours HOT 2
- NoMethodError: undefined method `wday' for nil:NilClass HOT 4
- dates.days(0).after returns nil HOT 4
- Short days before holiday HOT 2
- Store configuration in a database HOT 4
- Timezone not included in returned time objects HOT 2
- Infinity loop when no hours are configured HOT 3
- Times spanning over midnight (nonsensical hours provided) HOT 2
- Please consider adding a changelog HOT 3
- Strange behavior with 24-hour work days HOT 7
- help! 在设置shifts之后,时长计算有误,麻烦关注一下 HOT 1
- Export to schema.org OpeningHoursSpecification HOT 1
- Incorrect periods and working hours when shifts and hours fall on same day HOT 1
- How to handle cases where two schedules don't intersect at all? HOT 1
- Creating empty Biz::Schedule HOT 7
- TypeError Exception when using Ruby 2.4.0
- Documentation for setting global config in Rails HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biz.