lib/synvert/snippet.rb in synvert-1.2.2 vs lib/synvert/snippet.rb in synvert-1.2.4

- old
+ new

@@ -1,18 +1,10 @@ # frozen_string_literal: true -require 'open-uri' -require 'json' - module Synvert # Manage synvert snippets. class Snippet - def self.fetch_core_version - content = uri_open('https://rubygems.org/api/v1/versions/synvert-core.json').read - JSON.parse(content).first['number'] - end - def initialize(snippets_path) @snippets_path = snippets_path end # synchronize snippets from github. @@ -21,17 +13,9 @@ Dir.chdir(@snippets_path) do Kernel.system('git checkout . && git pull --rebase') end else Kernel.system("git clone https://github.com/xinminlabs/synvert-snippets-ruby.git #{@snippets_path}") - end - end - - def self.uri_open(url) - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0') - URI.open(url) - else - open(url) end end end end