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.



130
# File 'lib/lafcadio/test.rb', line 130

def initialize; @last_domain_class = nil; end

Instance Method Details

#default_symbol_name(domain_class) ⇒ Object



132
133
134
# File 'lib/lafcadio/test.rb', line 132

def default_symbol_name( domain_class )
	"@#{ domain_class.name.camel_case_to_underscore }"
end

#finishObject



136
137
138
139
140
# File 'lib/lafcadio/test.rb', line 136

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



142
143
144
145
146
147
148
149
150
151
152
# File 'lib/lafcadio/test.rb', line 142

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