lib/eia/data.rb in eia-1.1.3 vs lib/eia/data.rb in eia-1.1.4
- old
+ new
@@ -55,10 +55,14 @@
def value
return @value.to_f
end
+ def periodicity
+ return @periodicity
+ end
+
def is_valid?
if @table_code == '' or @table_code == nil or @table_code.to_i <= 0 then
puts "Invalid table code supplied. Value is #{@table_code}."
return false
end
@@ -78,9 +82,14 @@
return false
end
if @unit == '' or @unit == nil then
puts "Unit found is invalid. Value is '#{@unit}'."
+ return false
+ end
+
+ if @periodicity == nil or @periodicity.to_i > 5 or @periodicity.to_i < 0 then
+ puts "Periodicity is invalid. Value is '#{@periodicity}'."
return false
end
if @value == '' or @value == nil then
puts "Value found is invalid. Value is '#{@value}'."