Class: EmacsOrgProtocolServer::Settings
- Inherits:
-
Object
- Object
- EmacsOrgProtocolServer::Settings
- Defined in:
- lib/emacs_org_protocol_server.rb
Instance Attribute Summary collapse
-
#bind ⇒ Object
Returns the value of attribute bind.
-
#config_file ⇒ Object
Returns the value of attribute config_file.
-
#emacsclient ⇒ Object
Returns the value of attribute emacsclient.
-
#port ⇒ Object
Returns the value of attribute port.
-
#server ⇒ Object
Returns the value of attribute server.
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
-
#initialize(server: '0.0.0.0', port: 4567, bind: '0.0.0.0', config_file: nil) ⇒ Settings
constructor
A new instance of Settings.
Constructor Details
#initialize(server: '0.0.0.0', port: 4567, bind: '0.0.0.0', config_file: nil) ⇒ Settings
Returns a new instance of Settings.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/emacs_org_protocol_server.rb', line 11 def initialize(server: '0.0.0.0', port: 4567, bind: '0.0.0.0', config_file: nil) self.config_file = config_file || ENV['EMACS_ORG_PROTOCOL_CONFIG'] || File.join(ENV['HOME'], '.config', 'emacs_org_protocol_server.yml') self.settings = {} if File.exist?(self.config_file) self.settings = YAML.load( ERB.new( File.read(self.config_file) ).result ) end self.server = ENV['EMACS_ORG_PROTOCOL_SERVER'] || settings["server"] || %w[thin mongrel webrick] self.port = ENV['EMACS_ORG_PROTOCOL_PORT'] || settings["port"] || '4567' self.bind = ENV['EMACS_ORG_PROTOCOL_BIND'] || settings["bind"] || '0.0.0.0' self.emacsclient = ENV['EMACSCLIENT'] || "/usr/local/bin/emacsclient" end |
Instance Attribute Details
#bind ⇒ Object
Returns the value of attribute bind.
10 11 12 |
# File 'lib/emacs_org_protocol_server.rb', line 10 def bind @bind end |
#config_file ⇒ Object
Returns the value of attribute config_file.
10 11 12 |
# File 'lib/emacs_org_protocol_server.rb', line 10 def config_file @config_file end |
#emacsclient ⇒ Object
Returns the value of attribute emacsclient.
10 11 12 |
# File 'lib/emacs_org_protocol_server.rb', line 10 def emacsclient @emacsclient end |
#port ⇒ Object
Returns the value of attribute port.
10 11 12 |
# File 'lib/emacs_org_protocol_server.rb', line 10 def port @port end |
#server ⇒ Object
Returns the value of attribute server.
10 11 12 |
# File 'lib/emacs_org_protocol_server.rb', line 10 def server @server end |
#settings ⇒ Object
Returns the value of attribute settings.
10 11 12 |
# File 'lib/emacs_org_protocol_server.rb', line 10 def settings @settings end |