Class: Lafcadio::DomainMock::DomainClassSymbolMapper
- Inherits:
-
Hash
- Object
- Hash
- Lafcadio::DomainMock::DomainClassSymbolMapper
- Defined in:
- lib/lafcadio/test.rb
Overview
:nodoc:
Instance Method Summary collapse
- #default_symbol_name(domain_class) ⇒ Object
- #finish ⇒ Object
-
#initialize ⇒ DomainClassSymbolMapper
constructor
A new instance of DomainClassSymbolMapper.
- #process(domain_class_or_symbol_name) ⇒ Object
Constructor Details
#initialize ⇒ DomainClassSymbolMapper
Returns a new instance of DomainClassSymbolMapper.
97 |
# File 'lib/lafcadio/test.rb', line 97 def initialize; @last_domain_class = nil; end |
Instance Method Details
#default_symbol_name(domain_class) ⇒ Object
99 100 101 |
# File 'lib/lafcadio/test.rb', line 99 def default_symbol_name( domain_class ) "@#{ domain_class.name.camel_case_to_underscore }" end |
#finish ⇒ Object
103 104 105 106 107 |
# File 'lib/lafcadio/test.rb', line 103 def finish if @last_domain_class self[@last_domain_class] = default_symbol_name( @last_domain_class ) end end |
#process(domain_class_or_symbol_name) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/lafcadio/test.rb', line 109 def process( domain_class_or_symbol_name ) if domain_class_or_symbol_name.class == Class if @last_domain_class self[@last_domain_class] = default_symbol_name( @last_domain_class ) end @last_domain_class = domain_class_or_symbol_name else self[@last_domain_class] = domain_class_or_symbol_name @last_domain_class = nil end end |