class General::GTimeFormat
A special template used for formatting time strings
Author: Anshul Kharbanda Created: 7 - 2 - 2016
Public Class Methods
new(string)
click to toggle source
Initialize the GTimeFormat
with the given string
Parameter: string - the template string
Calls superclass method
General::GBaseTemplate::new
# File lib/gtemplates/gtimeformat.rb, line 35 def initialize string super(string, [ General::GSpecial, General::GText, General::GTimeFormatPlaceholder ]) end
Public Instance Methods
apply(value)
click to toggle source
Applies the given integer value to the template and returns the generated string
Parameter: value - the value to be applied (as a hash. merges with defaults)
Return: string of the template with the given value applied
Calls superclass method
General::GBaseTemplate#apply
# File lib/gtemplates/gtimeformat.rb, line 48 def apply value if value.is_a? Integer super value else raise TypeError.new "Expected Integer, got: #{value.class}" end end