class FcrepoWrapper::Settings
Configuraton that comes from static and dynamic sources.
Public Class Methods
new(static_config)
click to toggle source
Calls superclass method
# File lib/fcrepo_wrapper/settings.rb, line 15 def initialize(static_config) super @static_config = static_config end
Public Instance Methods
__getobj__()
click to toggle source
# File lib/fcrepo_wrapper/settings.rb, line 5 def __getobj__ @static_config # return object we are delegating to, required end
Also aliased as: static_config
__setobj__(obj)
click to toggle source
# File lib/fcrepo_wrapper/settings.rb, line 11 def __setobj__(obj) @static_config = obj end
port()
click to toggle source
Get the port this fcrepo instance is running at
# File lib/fcrepo_wrapper/settings.rb, line 22 def port @port ||= static_config.port @port ||= random_open_port.to_s end
Private Instance Methods
random_open_port()
click to toggle source
# File lib/fcrepo_wrapper/settings.rb, line 29 def random_open_port socket = Socket.new(:INET, :STREAM, 0) begin socket.bind(Addrinfo.tcp('127.0.0.1', 0)) socket.local_address.ip_port ensure socket.close end end