Method: Osm::Model.configure
- Defined in:
- lib/osm/model.rb
.configure(options) ⇒ Object
Configure the options used by all models
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/osm/model.rb', line 27 def self.configure() raise ArgumentError, ":ttl must be a FixNum greater than 0" if [:ttl] && !([:ttl].is_a?(Fixnum) && [:ttl] > 0) raise ArgumentError, ":prepend_to_key must be a String" if [:prepend_to_key] && ![:prepend_to_key].is_a?(String) if [:cache] [:exist?, :delete, :write, :read].each do |method| raise ArgumentError, ":cache must have a #{method} method" unless [:cache].methods.include?(method) end end @@cache = [:cache] @@cache_prepend = [:prepend_to_key] || 'OSMAPI' @@cache_ttl = [:ttl] || 600 nil end |