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

Already on GitHub? Sign in to your account

at() method in Time class should take optional second argument #34

Closed
scpike opened this Issue Jan 12, 2012 · 1 comment

Comments

Projects
None yet
2 participants

scpike commented Jan 12, 2012

Ruby-units overrides the Time class's at() method with a new on that only accepts one argument.

The standard time class accepts an optional second microseconds method
http://ruby-doc.org/core-1.9.3/Time.html

I think it would be enough to add a second optional milliseconds argument to your at() method and pass it through to the unit_time_at call in the else{} block, but I'm not totally sure.

def self.at(arg, ms = 0)
  case arg
  when Unit
    unit_time_at(arg.convert_to("s").scalar)
  else
    unit_time_at(arg, ms)
  end
end
Owner

olbrich commented Jan 13, 2012

good catch, I'll patch this in the next release

@olbrich olbrich closed this in 431dcab Feb 2, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment