Class: Ebay::Schema::ClassTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/ebay/schema/mapper/class_template.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ClassTemplate) initialize(name) {|_self| ... }

Returns a new instance of ClassTemplate

Yields:

  • (_self)

Yield Parameters:



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

- (Object) name (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

- (Boolean) exists?

Returns:

  • (Boolean)


27
28
29
# File 'lib/ebay/schema/mapper/class_template.rb', line 27

def exists?
  File.exists?(template_path)
end

- (Object) load



17
18
19
20
# File 'lib/ebay/schema/mapper/class_template.rb', line 17

def load
  @template = load_template
  self
end

- (Object) render(definition)

Raises:



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