Class: Time
Overview
Add the ability to use Time class
Contributed by Paul Wright
Constant Summary
Constants included from Runt
Runt::April, Runt::August, Runt::DAYS, Runt::December, Runt::Eighth, Runt::Eigth, Runt::February, Runt::Fifth, Runt::First, Runt::Fourth, Runt::Fri, Runt::Friday, Runt::January, Runt::July, Runt::June, Runt::Last, Runt::Last_of, Runt::MONTHS, Runt::March, Runt::May, Runt::Mon, Runt::Monday, Runt::Ninth, Runt::November, Runt::ORDINAL_ABBR, Runt::ORDINAL_SUFFIX, Runt::October, Runt::Sat, Runt::Saturday, Runt::Second, Runt::Second_to_last, Runt::September, Runt::Seventh, Runt::Sixth, Runt::Sun, Runt::Sunday, Runt::Tenth, Runt::Third, Runt::Thu, Runt::Thursday, Runt::Tue, Runt::Tuesday, Runt::VERSION, Runt::WEEK_OF_MONTH_ORDINALS, Runt::Wed, Runt::Wednesday
Instance Attribute Summary collapse
-
#date_precision ⇒ Object
Returns the value of attribute date_precision.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Time
constructor
A new instance of Time.
- #old_initialize ⇒ Object
- #old_to_yaml ⇒ Object
-
#precision ⇒ Object
Returns the value of attribute date_precision.
- #to_yaml(options) ⇒ Object
Methods included from Runt
#build, const, day_name, format_date, format_time, #method_missing, month_name, ordinalize, #parse_time
Constructor Details
#initialize(*args) ⇒ Time
Returns a new instance of Time.
190 191 192 193 194 195 196 197 |
# File 'lib/runt.rb', line 190 def initialize(*args) if(args[0].instance_of?(Runt::DPrecision::Precision)) @precision=args.shift else @precision=Runt::DPrecision::DEFAULT end old_initialize(*args) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Runt
Instance Attribute Details
#date_precision ⇒ Object
Returns the value of attribute date_precision.
186 187 188 |
# File 'lib/runt.rb', line 186 def date_precision @date_precision end |
Class Method Details
.old_parse ⇒ Object
209 |
# File 'lib/runt.rb', line 209 alias_method :old_parse, :parse |
.parse(*args) ⇒ Object
210 211 212 213 214 215 216 217 218 |
# File 'lib/runt.rb', line 210 def parse(*args) precision=Runt::DPrecision::DEFAULT if(args[0].instance_of?(Runt::DPrecision::Precision)) precision=args.shift end _parse=old_parse(*args) _parse.date_precision=precision _parse end |
Instance Method Details
#old_initialize ⇒ Object
187 |
# File 'lib/runt.rb', line 187 alias_method :old_initialize, :initialize |
#old_to_yaml ⇒ Object
199 |
# File 'lib/runt.rb', line 199 alias :old_to_yaml :to_yaml |
#precision ⇒ Object
Returns the value of attribute date_precision.
188 189 190 |
# File 'lib/runt.rb', line 188 def date_precision @date_precision end |