Class: Humble::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/humble/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_stringObject (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_factoryObject



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