Sha256: e6b485e17d4dcc40b28a5502061870bb0da0f1c99c9e3b37a7745a37e4784d48
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require 'readline' module Facebokr class Shell class Sandbox < BasicObject def initialize(app) @app = app end def access_token @app.access_token end alias_method :token, :access_token def test_user(options = {}) @app.create_test_user(options) end alias_method :tu, :test_user def app_request(*args) @app.create_app_request(*args) end alias_method :ar, :app_request def app_notification(*args) @app.create_app_notification(*args) end alias_method :an, :app_notification end attr_accessor :app def initialize(app) @app = app end def run while buf = Readline.readline(prompt, true) do puts format Sandbox.new(app).instance_eval(buf) end end private def prompt '-> ' end def format(obj) case obj when String obj when Hash obj.map { |data| "%-20s: %s" % data }.join("\n") when Array obj.map(&method(:format)).join("\n") else obj.inspect end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
facebokr-0.0.3 | lib/facebokr/shell.rb |