Class: Humble::Configuration
- Inherits:
-
Object
- Object
- Humble::Configuration
- Defined in:
- lib/humble/configuration.rb
Instance Attribute Summary collapse
-
#connection_string ⇒ Object
readonly
Returns the value of attribute connection_string.
Instance Method Summary collapse
- #add(mapping) ⇒ Object
- #build_session_factory ⇒ Object
-
#initialize(connection_string) ⇒ Configuration
constructor
A new instance of Configuration.
- #mapping_for(item) ⇒ Object
Constructor Details
#initialize(connection_string) ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 |
# File 'lib/humble/configuration.rb', line 5 def initialize(connection_string) @mappings = [] @connection_string = connection_string end |
Instance Attribute Details
#connection_string ⇒ Object (readonly)
Returns the value of attribute connection_string.
3 4 5 |
# File 'lib/humble/configuration.rb', line 3 def connection_string @connection_string end |
Instance Method Details
#add(mapping) ⇒ Object
10 11 12 |
# File 'lib/humble/configuration.rb', line 10 def add(mapping) @mappings.push(prepare(mapping)) end |
#build_session_factory ⇒ Object
14 15 16 |
# File 'lib/humble/configuration.rb', line 14 def build_session_factory SessionFactory.new(self) end |
#mapping_for(item) ⇒ Object
18 19 20 21 22 |
# File 'lib/humble/configuration.rb', line 18 def mapping_for(item) @mappings.find do |mapping| mapping.matches?(item) end end |