Module: RubyStation

Defined in:
lib/ruby-station.rb

Class Method Summary collapse

Class Method Details

.data_dirObject



24
# File 'lib/ruby-station.rb', line 24

def self.data_dir; @data_dir; end

.data_path(filename) ⇒ Object



25
26
27
# File 'lib/ruby-station.rb', line 25

def self.data_path(filename)
  File.expand_path(filename, @data_dir)
end

.parse_argvObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ruby-station.rb', line 7

def self.parse_argv
  OptionParser.new{|o|
    o.on("--port N"){|n| @port = n}
    o.on("--data-dir PATH"){|d| @data_dir = d}
  }.parse!(ARGV)

  unless @port
    @port = 40000 + rand(10000)
    warn "--port is not specified; assuming it is #{@port}"
  end
  unless @data_dir
    @data_dir = File.expand_path("./")
    warn "--data-dir is not specified; assuming it is #{@data_dir}" 
  end
end

.portObject



23
# File 'lib/ruby-station.rb', line 23

def self.port; @port; end