Object
Emits the given field as a two-digit number with a leading zero if necessary.
@param [field] the field to be formatted (e.g. :month, :year)
# File lib/stamp/emitters/two_digit.rb, line 11 def initialize(field, &block) @field = field @modifier = block end
# File lib/stamp/emitters/two_digit.rb, line 16 def format(target) value = modify(target.send(field)) value < 10 ? "0#{value}" : value end
[Validate]
Generated with the Darkfish Rdoc Generator 2.