Class: Ebay::Schema::Enumeration
- Inherits:
-
Object
- Object
- Ebay::Schema::Enumeration
- Includes:
- Inflections
- Defined in:
- lib/ebay/schema/mapper/enumeration.rb
Constant Summary
Constants included from Inflections
Inflections::DOWNCASE_TOKENS, Inflections::NAME_MAPPINGS, Inflections::UPCASE_TOKENS
Instance Attribute Summary collapse
-
#codes ⇒ Object
Returns the value of attribute codes.
Instance Method Summary collapse
-
#initialize(codes = []) ⇒ Enumeration
constructor
A new instance of Enumeration.
- #to_s ⇒ Object
Methods included from Inflections
#downcase_first_character, #ebay_camelize, #ebay_underscore, #underscore, #upcase_first_character
Constructor Details
#initialize(codes = []) ⇒ Enumeration
Returns a new instance of Enumeration.
7 8 9 10 |
# File 'lib/ebay/schema/mapper/enumeration.rb', line 7 def initialize(codes = []) codes.delete('CustomCode') @codes = codes end |
Instance Attribute Details
#codes ⇒ Object
Returns the value of attribute codes.
6 7 8 |
# File 'lib/ebay/schema/mapper/enumeration.rb', line 6 def codes @codes end |
Instance Method Details
#to_s ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ebay/schema/mapper/enumeration.rb', line 12 def to_s <<-END CODES = #{@codes.inspect} class << self def codes CODES end CODES.each do |code| define_method(ebay_underscore(code) do new(code) end end end END end |