Class: Ebay::Schema::ClassTemplate
- Inherits:
-
Object
- Object
- Ebay::Schema::ClassTemplate
- Defined in:
- lib/ebay/schema/mapper/class_template.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(name) {|_self| ... } ⇒ ClassTemplate
constructor
A new instance of ClassTemplate.
- #load ⇒ Object
- #render(definition) ⇒ Object
Constructor Details
#initialize(name) {|_self| ... } ⇒ ClassTemplate
Returns a new instance of ClassTemplate.
12 13 14 15 |
# File 'lib/ebay/schema/mapper/class_template.rb', line 12 def initialize(name) @name = name yield self if block_given? end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/ebay/schema/mapper/class_template.rb', line 11 def name @name end |
Instance Method Details
#exists? ⇒ Boolean
27 28 29 |
# File 'lib/ebay/schema/mapper/class_template.rb', line 27 def exists? File.exists?(template_path) end |
#load ⇒ Object
17 18 19 20 |
# File 'lib/ebay/schema/mapper/class_template.rb', line 17 def load @template = load_template self end |
#render(definition) ⇒ Object
22 23 24 25 |
# File 'lib/ebay/schema/mapper/class_template.rb', line 22 def render(definition) raise TemplateError, "No template has been loaded" if @template.nil? @template.result(definition.send(:binding)) end |