Sha256: 860fd7b68059b36fe02e98bfb0ef832fd6a339baf2068a416c16597bf591d0bb

Contents?: true

Size: 568 Bytes

Versions: 3

Compression:

Stored size: 568 Bytes

Contents

require 'addressable/uri'

module Livefyre
  class LivefyreUtil
    def self.uri?(string)
      uri = Addressable::URI.parse(string)
      %w( ftp ftps http https ).include?(uri.scheme)
    rescue Addressable::URI::BadURIError
      false
    rescue Addressable::URI::InvalidURIError
      false
    end
    
    def self.get_network_from_core(core)
      if core.class.name == 'Livefyre::Collection'
        return core.site.network
      elsif core.class.name == 'Livefyre::Site'
        return core.network
      else
        return core
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
livefyre-2.0.2 lib/livefyre/utils/livefyre_util.rb
livefyre-2.0.1 lib/livefyre/utils/livefyre_util.rb
livefyre-2.0.0 lib/livefyre/utils/livefyre_util.rb