module Oversetter

The Oversetter module handles base functionality.

Constants

VERSION

Semantic program version

Public Class Methods

http(http) click to toggle source

Optionally sets HTTP adapter with httpi. Supports [:httpclient, :curb, :em_http, :net_http_persistent, :excon, :rack]

@param http [Symbol] The http adapter to use. Smart defaults.

# File lib/oversetter.rb, line 19
def self.http(http)
  HTTPI.adapter = http
end
json(mj) click to toggle source

Optionally sets JSON adapter with multi_json. Supports [:oj, :yajl, :json_gem, :json_pure]

@param mj [Symbol] The JSON adapter to use. Smart defaults.

# File lib/oversetter.rb, line 27
def self.json(mj)
  MultiJson.use(mj)
end
label(label) click to toggle source

Prints colored element label.

@param label [String] The label to print

# File lib/oversetter.rb, line 42
def self.label(label)
  print Rainbow('[').blue.bright
  print Rainbow(label).green.bright
  print Rainbow(']').blue.bright
  print Rainbow('|').bright
end
tofile(obj) click to toggle source

Adds an object to the outfile array.

@param obj [String] The item to add

# File lib/oversetter.rb, line 52
def self.tofile(obj)
  if $fmt != nil
    $tofile.push obj
  end
end
xml(mx) click to toggle source

Optionally sets XML adapter with multi_xml. Supports [:ox, :libxml, :nokogiri, :rexml]

@param mx [Symbol] The XML adapter to use. Smart defaults.

# File lib/oversetter.rb, line 35
def self.xml(mx)
  MultiXml.parser = mx
end