class Phantomrb::Configuration

Attributes

executable[R]
options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/phantomrb/configuration.rb, line 5
def initialize(options = {})
  @options    = options
  @executable = 'phantomjs'
end

Public Instance Methods

merge(options) click to toggle source
# File lib/phantomrb/configuration.rb, line 14
def merge(options)
  Configuration.new(@options.merge(options))
end
option(key, value) click to toggle source
# File lib/phantomrb/configuration.rb, line 10
def option(key, value)
  @options[key] = value
end
to_options() click to toggle source
# File lib/phantomrb/configuration.rb, line 18
def to_options
  @options.inject({}) do |hash, (key, value)|
    hash[key.to_s.gsub('_', '-')] = value
    hash
  end
end
to_s() click to toggle source
# File lib/phantomrb/configuration.rb, line 25
def to_s
  to_options.reduce(@executable) do |memo, (key, value)|
    "#{memo} --#{key}=#{value}"
  end
end