Class: Frequency
Overview
Constant Summary collapse
- ALL =
[ F_1hr = Frequency.new("1hr", 1.0/24), F_3hr = Frequency.new("3hr", 3.0/24), F_6hr = Frequency.new("6hr", 6.0/24), F_day = Frequency.new("day", 1.0), # there is no dayPt frequency F_mon = Frequency.new("mon", 30.0), F_yr = Frequency.new("yr", 365.0), F_dec = Frequency.new("dec", 3650.0), F_hrPt = Frequency.new("1hrPt", 1.0/24, TimeMethods::POINT), F_3hrPt = Frequency.new("3hrPt", 3.0/24, TimeMethods::POINT), F_6hrPt = Frequency.new("6hrPt", 6.0/24, TimeMethods::POINT), F_monPt = Frequency.new("monPt", 30.0, TimeMethods::POINT), F_yrPt = Frequency.new("yrPt", 365.0, TimeMethods::POINT), F_1hrCM = Frequency.new("1hrCM", 1.0/24, TimeMethods::CLIMATOLOGY), F_fx = Frequency.new("fx", 0, TimeMethods::NONE), F_monC = Frequency.new("monC", 30.0, TimeMethods::CLIMATOLOGY), F_subhrPt = Frequency.new("subhrPt", 0.017361, TimeMethods::POINT), # there is no subhr time:mean ]
Instance Attribute Summary collapse
-
#approx_interval ⇒ Object
readonly
Returns the value of attribute approx_interval.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#time_method ⇒ Object
readonly
Returns the value of attribute time_method.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(name, approx_interval, time_method = TimeMethods::MEAN) ⇒ Frequency
constructor
A new instance of Frequency.
Constructor Details
#initialize(name, approx_interval, time_method = TimeMethods::MEAN) ⇒ Frequency
Returns a new instance of Frequency.
19 20 21 22 23 |
# File 'lib/frequency.rb', line 19 def initialize(name, approx_interval, time_method=TimeMethods::MEAN) @name = name @approx_interval = approx_interval @time_method = time_method end |
Instance Attribute Details
#approx_interval ⇒ Object (readonly)
Returns the value of attribute approx_interval.
9 10 11 |
# File 'lib/frequency.rb', line 9 def approx_interval @approx_interval end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/frequency.rb', line 9 def name @name end |
#time_method ⇒ Object (readonly)
Returns the value of attribute time_method.
9 10 11 |
# File 'lib/frequency.rb', line 9 def time_method @time_method end |
Class Method Details
.for_name(n) ⇒ Object
12 13 14 15 16 |
# File 'lib/frequency.rb', line 12 def self.for_name(n) freq = ALL.find {|f| f.name == n} raise "can not determine Frequency object for #{n}" unless freq freq end |
Instance Method Details
#<=>(other) ⇒ Object
46 47 48 |
# File 'lib/frequency.rb', line 46 def <=>(other) @approx_interval <=> other.approx_interval end |
#==(other) ⇒ Object
51 52 53 |
# File 'lib/frequency.rb', line 51 def ==(other) @name == other.name end |