Sha256: 412a793dcf452d5a0477970d2429e73de0ba332fe60b1e8a326d196406966e6a

Contents?: true

Size: 725 Bytes

Versions: 7

Compression:

Stored size: 725 Bytes

Contents

# -*- coding: utf-8 -*-
require 'rubygems'
require 'launchy'
require 'uri'
require 'hiroshimarb/command'

module Hiroshimarb::Commands
  class Open < Hiroshimarb::Command

    @@default_key = 'hiroshimarb'

    def call(*args)
      command = args.first
      command ||= @@default_key
      Launchy.open key2url(command)
    end

    def key2url(key)
      case key
      when 'hiroshimarb'
        'http://hiroshimarb.github.com'
      when 'oc-h'
        'http://oc-h.jp'
      when 'ipad'
        URI.encode 'http://kita.dyndns.org/wiki/?広島弁吹き替えシリーズ'
      when 'city'
        'http://www.city.hiroshima.lg.jp'
      when 'pref'
        'http://www.pref.hiroshima.lg.jp'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hiroshimarb-0.2.5 lib/hiroshimarb/commands/open.rb
hiroshimarb-0.2.4 lib/hiroshimarb/commands/open.rb
hiroshimarb-0.2.3 lib/hiroshimarb/commands/open.rb
hiroshimarb-0.2.2 lib/hiroshimarb/commands/open.rb
hiroshimarb-0.2.1 lib/hiroshimarb/commands/open.rb
hiroshimarb-0.2.0 lib/hiroshimarb/commands/open.rb
hiroshimarb-0.1.4 lib/hiroshimarb/commands/open.rb