Module: TripletHandling

Included in:
URI
Defined in:
lib/uri/triplets.rb

Constant Summary collapse

TRIPLET_CLASSES =
%w(Git SCP SSH).freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



97
98
99
# File 'lib/uri/triplets.rb', line 97

def self.included(base)
  base.extend(TripletHandling)
end

Instance Method Details

#default_triplet_typeObject



101
102
103
# File 'lib/uri/triplets.rb', line 101

def default_triplet_type
  @default_triplet_type ||= "SSH"
end

#default_triplet_type=(value) ⇒ Object



105
106
107
108
109
110
# File 'lib/uri/triplets.rb', line 105

def default_triplet_type=(value)
  unless TRIPLET_CLASSES.include?(value)
    raise ArgumentError, "'#{value}' is not one of: #{TRIPLET_CLASSES.join(', ')}"
  end
  @default_triplet_type = value
end

#parserObject



112
113
114
115
116
# File 'lib/uri/triplets.rb', line 112

def parser
  return URI::RFC3986_Parser if
    Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.2.0")
  URI::Parser
end