Method: Ana::Command#open

Defined in:
lib/ana/command.rb

#open(gem, open_type = 'home') ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/ana/command.rb', line 133

def open(gem, open_type='home')
  return if gem_does_not_exist?(gem)
  gem_hash = get_gem_json!(gem, type: 'gems')
  url = if URI_TYPE.keys.include? open_type
          skip = false
          gem_hash[URI_TYPE[open_type]]
        else
          say "#{open_type} is not a valid type :( \n"
          print_valid_uri_open_types!
          skip = true
        end
  Launchy.open(url) if url.present? && skip == false
  say "Nothing to open, this gem probably does not have #{open_type} page" if url.blank? || skip
end