Class: Ebay::Schema::ClassDefinition

Inherits:
Object
  • Object
show all
Includes:
Inflections, RubyClassGeneratorHelper
Defined in:
lib/ebay/schema/mapper/class_definition.rb

Constant Summary

Constants included from Inflections

Inflections::DOWNCASE_TOKENS, Inflections::NAME_MAPPINGS, Inflections::UPCASE_TOKENS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inflections

#downcase_first_character, #ebay_camelize, #ebay_underscore, #underscore, #upcase_first_character

Constructor Details

#initialize(class_name, element_name, module_name, superclass_name = nil) ⇒ ClassDefinition

Returns a new instance of ClassDefinition.



9
10
11
12
13
14
# File 'lib/ebay/schema/mapper/class_definition.rb', line 9

def initialize(class_name, element_name, module_name, superclass_name = nil)
  @class_name, @module_name = class_name, module_name
  @element_name = element_name
  @superclass_name = superclass_name.gsub(/(Request|Response)$/, '') unless superclass_name.nil?
  @documentation = ''
end

Instance Attribute Details

#class_nameObject

Returns the value of attribute class_name.



7
8
9
# File 'lib/ebay/schema/mapper/class_definition.rb', line 7

def class_name
  @class_name
end

#documentationObject

Returns the value of attribute documentation.



7
8
9
# File 'lib/ebay/schema/mapper/class_definition.rb', line 7

def documentation
  @documentation
end

#element_nameObject

Returns the value of attribute element_name.



7
8
9
# File 'lib/ebay/schema/mapper/class_definition.rb', line 7

def element_name
  @element_name
end

#module_nameObject

Returns the value of attribute module_name.



7
8
9
# File 'lib/ebay/schema/mapper/class_definition.rb', line 7

def module_name
  @module_name
end

#nodesObject

Returns the value of attribute nodes.



7
8
9
# File 'lib/ebay/schema/mapper/class_definition.rb', line 7

def nodes
  @nodes
end

#requiresObject

Returns the value of attribute requires.



7
8
9
# File 'lib/ebay/schema/mapper/class_definition.rb', line 7

def requires
  @requires
end

#superclass_nameObject

Returns the value of attribute superclass_name.



7
8
9
# File 'lib/ebay/schema/mapper/class_definition.rb', line 7

def superclass_name
  @superclass_name
end

Instance Method Details

#class_definitionObject



34
35
36
37
38
# File 'lib/ebay/schema/mapper/class_definition.rb', line 34

def class_definition
  result = @class_name.dup
  result << " < #{@superclass_name}" unless @superclass_name.nil?
  result
end

#customizationObject



44
45
46
# File 'lib/ebay/schema/mapper/class_definition.rb', line 44

def customization
  @customization ||= ''
end

#customization=(value) ⇒ Object



40
41
42
# File 'lib/ebay/schema/mapper/class_definition.rb', line 40

def customization=(value)
  @customization = value
end