Hello everyone! Is it possible to modify this function: beginning_of_week? What I want is something like this : beginning_of_week(0) returns Sunday beginning_of_week(1) returns Monday Thank you! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
What''s the argument that you''re passing the method? Just an integer? On Feb 27, 12:58 am, Guillaume Loader <rails-mailing-l...@andreas- s.net> wrote:> Hello everyone! > > Is it possible to modify this function: beginning_of_week? > > What I want is something like this : > beginning_of_week(0) returns Sunday > beginning_of_week(1) returns Monday > > Thank you! > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I see 2 ways you could do this 1. Re-open the class that offers the functionality and add your code to modify the behavior. I would not recommend that. I like leaving code that I didn''t write as it is. 2. Create something very simple that receives the parameter you need and acts accordingly to use the existing beginning_of_week behavior and get what you want. On Feb 26, 7:58 pm, Guillaume Loader <rails-mailing-l...@andreas- s.net> wrote:> Hello everyone! > > Is it possible to modify this function: beginning_of_week? > > What I want is something like this : > beginning_of_week(0) returns Sunday > beginning_of_week(1) returns Monday > > Thank you! > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---