class ExampleFormatter
Constants
- FORMATS
- FORMAT_MATCHER
Attributes
reference[RW]
Public Class Methods
new(reference)
click to toggle source
# File lib/date_by_example/example_formatter.rb, line 4 def initialize(reference) @reference = reference @format_string = nil end
Public Instance Methods
format(date)
click to toggle source
# File lib/date_by_example/example_formatter.rb, line 46 def format(date) date.strftime(format_string) end
format_string()
click to toggle source
# File lib/date_by_example/example_formatter.rb, line 42 def format_string @format_string ||= reference.gsub(FORMAT_MATCHER, FORMATS) end