Class: PrefetchRspec::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/prefetch_rspec.rb

Direct Known Subclasses

Runner, Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Base

Returns a new instance of Base.



9
10
11
# File 'lib/prefetch_rspec.rb', line 9

def initialize(args)
  optparse(args.to_a)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/prefetch_rspec.rb', line 7

def options
  @options
end

Instance Method Details

#color(str, col = 37) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/prefetch_rspec.rb', line 17

def color(str, col = 37)
  if STDOUT.tty?
    "\033[1;#{col}m%s\033[0m" % str
  else
    str
  end
end

#cwarn(str, col = 37) ⇒ Object



13
14
15
# File 'lib/prefetch_rspec.rb', line 13

def cwarn(str, col = 37)
  warn color(str, col)
end

#drb_uriObject



25
26
27
# File 'lib/prefetch_rspec.rb', line 25

def drb_uri
  "druby://127.0.0.1:#{options[:port] || DEFAULT_PORT }"
end