module Cda::XmlBuilder::Helpers
Public Instance Methods
apply_format(value, format)
click to toggle source
# File lib/cda/xml_builder.rb, line 26 def apply_format(value, format) send("format_#{format}", value) end
auto_format(value)
click to toggle source
# File lib/cda/xml_builder.rb, line 43 def auto_format(value) if (format = determine_format(value)) apply_format(value, format) else value.to_s end end
determine_format(value)
click to toggle source
# File lib/cda/xml_builder.rb, line 30 def determine_format(value) case value when Time, DateTime :datetime when Date :date when Array :array else nil end end
format_array(array)
click to toggle source
# File lib/cda/xml_builder.rb, line 22 def format_array(array) array.join(" ") end
format_date(time)
click to toggle source
# File lib/cda/xml_builder.rb, line 10 def format_date(time) time.presence && Cda::ValueCoercer.date_to_string(time) || '' end
format_datetime(time)
click to toggle source
# File lib/cda/xml_builder.rb, line 6 def format_datetime(time) time.presence && Cda::ValueCoercer.date_time_to_string(time) || '' end
format_human_date(time)
click to toggle source
# File lib/cda/xml_builder.rb, line 18 def format_human_date(time) time.presence && Medapp::Formatting.format_date(time) || '' end
format_human_datetime(time)
click to toggle source
# File lib/cda/xml_builder.rb, line 14 def format_human_datetime(time) Medapp::Formatting.format_datetime(time) || '' end