Module: OpenEHR::AssumedLibraryTypes::ISO8601DateModule
- Includes:
- TimeDefinitions
- Defined in:
- lib/open_ehr/assumed_library_types.rb
Overview
end of TimeDefinitions
Constant Summary
Constants included from TimeDefinitions
TimeDefinitions::DAYS_IN_LEAP_YEAR, TimeDefinitions::DAYS_IN_WEEK, TimeDefinitions::DAYS_IN_YEAR, TimeDefinitions::HOURS_IN_DAY, TimeDefinitions::MAX_DAYS_IN_MONTH, TimeDefinitions::MAX_DAYS_IN_YEAR, TimeDefinitions::MINUTES_IN_HOUR, TimeDefinitions::MONTH_IN_YEAR, TimeDefinitions::NOMINAL_DAYS_IN_MONTH, TimeDefinitions::NOMINAL_DAYS_IN_YEAR, TimeDefinitions::SECONDS_IN_MINUTE
Instance Attribute Summary collapse
-
#day ⇒ Object
Returns the value of attribute day.
-
#month ⇒ Object
Returns the value of attribute month.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
- #as_string ⇒ Object
- #day_unknown? ⇒ Boolean
- #is_extended? ⇒ Boolean
- #is_partial? ⇒ Boolean
- #month_unknown? ⇒ Boolean
- #to_days ⇒ Object
Methods included from TimeDefinitions
valid_day?, valid_hour?, valid_minute?, valid_month?, valid_second?, valid_year?
Instance Attribute Details
#day ⇒ Object
Returns the value of attribute day.
149 150 151 |
# File 'lib/open_ehr/assumed_library_types.rb', line 149 def day @day end |
#month ⇒ Object
Returns the value of attribute month.
149 150 151 |
# File 'lib/open_ehr/assumed_library_types.rb', line 149 def month @month end |
#year ⇒ Object
Returns the value of attribute year.
149 150 151 |
# File 'lib/open_ehr/assumed_library_types.rb', line 149 def year @year end |
Instance Method Details
#as_string ⇒ Object
169 170 171 172 173 174 175 176 177 |
# File 'lib/open_ehr/assumed_library_types.rb', line 169 def as_string if (!@year.nil? and !@month.nil? and !@day.nil?) Date.new(@year, @month, @day).to_s elsif (!@year.nil? and !@month.nil? and @day.nil?) Date.new(@year, @month).to_s[0,7] elsif (!@year.nil? and @month.nil? and @day.nil?) Date.new(@year).to_s[0,4] end end |
#day_unknown? ⇒ Boolean
190 191 192 |
# File 'lib/open_ehr/assumed_library_types.rb', line 190 def day_unknown? @day.nil? end |
#is_extended? ⇒ Boolean
194 195 196 |
# File 'lib/open_ehr/assumed_library_types.rb', line 194 def is_extended? true end |
#is_partial? ⇒ Boolean
198 199 200 |
# File 'lib/open_ehr/assumed_library_types.rb', line 198 def is_partial? month_unknown? or day_unknown? end |
#month_unknown? ⇒ Boolean
186 187 188 |
# File 'lib/open_ehr/assumed_library_types.rb', line 186 def month_unknown? @month.nil? end |
#to_days ⇒ Object
179 180 181 182 183 184 |
# File 'lib/open_ehr/assumed_library_types.rb', line 179 def to_days days = nilthenzero(@year)*TimeDefinitions::NOMINAL_DAYS_IN_YEAR + nilthenzero(@month)*TimeDefinitions::NOMINAL_DAYS_IN_MONTH + nilthenzero(@day) return days end |