Class: General::GTimeFormat
- Inherits:
-
GBaseTemplate
- Object
- GBaseTemplate
- General::GTimeFormat
- Defined in:
- lib/gtemplates/gtimeformat.rb
Overview
Created: 7 - 2 - 2016
Instance Method Summary collapse
-
#apply(value) ⇒ Object
Applies the given integer value to the template and returns the generated string.
-
#initialize(string) ⇒ GTimeFormat
constructor
Initialize the GTimeFormat with the given string.
Methods inherited from GBaseTemplate
Constructor Details
#initialize(string) ⇒ GTimeFormat
Initialize the GTimeFormat with the given string
Parameter: string - the template string
35 36 37 38 39 40 41 |
# File 'lib/gtemplates/gtimeformat.rb', line 35 def initialize string super(string, [ General::GSpecial, General::GText, General::GTimeFormatPlaceholder ]) end |
Instance Method Details
#apply(value) ⇒ Object
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
48 49 50 51 52 53 54 |
# 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 |