class Rsense::Server::Options

Attributes

code[RW]
command[RW]
config[RW]
debug[RW]
file[RW]
location[RW]
log[RW]
log_level[RW]
name[RW]
prefix[RW]
project_path[RW]
rest[RW]

Public Class Methods

new(opts) click to toggle source
# File lib/rsense/server/options.rb, line 10
def initialize(opts)
  @rest = {}
  @command = opts["command"] if opts["command"]
  parse_args(opts)
end

Public Instance Methods

debug?() click to toggle source
# File lib/rsense/server/options.rb, line 47
def debug?
  @debug
end
file=(path) click to toggle source
# File lib/rsense/server/options.rb, line 34
def file=(path)
  file = Pathname.new(path.to_s).expand_path
  if file.exist?
    @file = file
  else
    @file = Pathname.new(".")
  end
end
here_doc_reader(reader) click to toggle source
# File lib/rsense/server/options.rb, line 43
def here_doc_reader(reader)
  Rsense::Util::HereDocReader.new(reader, "EOF")
end
inherit(parent) click to toggle source
# File lib/rsense/server/options.rb, line 71
def inherit(parent)
  if parent.debug?
    @debug = true
  end
  @log = parent.log()
  @log_level = parent.log_level
  @load_path = parent.load_path
  @gem_path = parent.gem_path
end
load_config(config) click to toggle source
# File lib/rsense/server/options.rb, line 81
def load_config(config)
  path = Pathname.new(config).expand_path
  if path.exist?
    json = JSON.parse(path.read)
    parse_args(json)
  else
    puts "Config file: #{path} does not exist"
  end
end
parse_args(opts) click to toggle source
# File lib/rsense/server/options.rb, line 16
def parse_args(opts)
  opts.each_pair do |k, v|
    if respond_to?("#{k}=")
      __send__("#{k}=", v)
    else
      @rest[k] = v
    end
  end
end
progress() click to toggle source
# File lib/rsense/server/options.rb, line 63
def progress
  if @progress
    @progress.to_i
  else
    0
  end
end
project() click to toggle source
# File lib/rsense/server/options.rb, line 26
def project
  @project_path
end
project=(path) click to toggle source
# File lib/rsense/server/options.rb, line 30
def project=(path)
  @project_path = Pathname.new(path).expand_path
end