module Tldrb::Functions

Public Instance Methods

get_page(query, platform) click to toggle source
# File bin/tldrb, line 9
def get_page(query, platform)
  url = "https://raw.github.com/tldr-pages/tldr/master/pages/" \
        "#{platform}/#{query}.md"
  response = RestClient.get url

  response.to_str
rescue RestClient::Exception
  nil
end
my_platform() click to toggle source
# File bin/tldrb, line 19
def my_platform
  platform = Gem::Platform.local.os
  # TODO: suggest upstream use of "darwin" instead of "osx", since
  # "darwin" is what is actually used by OS X internally"
  platform = 'osx' if platform == 'darwin'
  return platform
end
supported_platforms() click to toggle source
# File bin/tldrb, line 27
def supported_platforms
  # TODO: check for supported platforms dynamically
  ['linux', 'osx', 'sunos']
end