Created
January 28, 2011 16:39
-
-
Save manuelkiessling/800520 to your computer and use it in GitHub Desktop.
Ruby class layout allowing a funny call combination
This file contains hidden or 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 Foo | |
def calculate_for_events(events) | |
@events = events | |
self | |
end | |
def between(time) | |
@start_time = time | |
self | |
end | |
def and(time) | |
@end_time = time | |
self | |
end | |
def in_chunks_of(chunk_size) | |
@chunk_size = chunk_size | |
self | |
end | |
def minutes | |
do_something() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Erlaubt Aufrufe wie diesen:
result = Foo.calculate_for_events([e1, e2]).between(Time.now-86400).and(Time.now).in_chunks_of(5).minutes