Class: Lafcadio::DomainMock::DomainClassSymbolMapper

Inherits:
Hash
  • Object
show all
Defined in:
lib/lafcadio/test.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeDomainClassSymbolMapper

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

#finishObject



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