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



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

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

Instance Method Details

#default_triplet_typeObject



110
111
112
# File 'lib/uri/triplets.rb', line 110

def default_triplet_type
  @default_triplet_type ||= "SSH"
end

#default_triplet_type=(value) ⇒ Object

Raises:

  • (ArgumentError)


114
115
116
117
118
# File 'lib/uri/triplets.rb', line 114

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

  @default_triplet_type = value
end

#parserObject



120
121
122
123
124
125
# File 'lib/uri/triplets.rb', line 120

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

  URI::Parser
end