Code Duplication    Length = 1-16 lines in 4 locations

lib/versionone_sdk/update.rb 1 location

@@ 30-45 (lines=16) @@
27
        unless @dTagTypes.key?(yTagType)
28
          raise ArgumentError, "E_BAD_TAG_TYPE: [#{yTagType.to_s}]"
29
        end
30
      else
31
        if sName.nil? || ! sName.kind_of?(String)
32
          raise ArgumentError, 'E_NO_ATTRIBUTE_NAME'
33
        elsif @dRelationships.key?(sName)
34
          aValues.each do |dValue|
35
            sAct = dValue[:act]
36
            if sAct    == 'set'
37
              yTagType =  :single_relationship
38
            elsif sAct == 'add' || sAct == 'remove'
39
              yTagType =  :multi_relationship
40
            else
41
              raise ArgumentError, "E_BAD_ACT: [#{sAct}]"
42
            end
43
          end
44
        else
45
          yTagType = :simple_attribute
46
        end
47
      end
48

lib/versionone_sdk/client.rb 3 locations

@@ 128-137 (lines=10) @@
125
    def buildUrl(sProtocol = DEFAULT_PROTOCOL, sHostname = DEFAULT_HOSTNAME, iPort = DEFAULT_PORT)
126
      if sHostname.nil?
127
        sHostname = 'localhost'
128
      elsif sHostname.is_a?(String)
129
        sHostname.strip!
130
        if sHostname.length < 1
131
          sHostname = 'localhost'
132
        end
133
      else
134
        raise ArgumentError, 'E_HOSTNAME_IS_NOT_A_STRING'
135
      end
136
      if iPort.nil?
137
        iPort = 80
138
      elsif iPort.is_a?(String) && iPort =~ /^[0-9]+$/
139
        iPort = iPort.to_i
140
      elsif ! iPort.kind_of?(Integer)
@@ 140-140 (lines=1) @@
137
        iPort = 80
138
      elsif iPort.is_a?(String) && iPort =~ /^[0-9]+$/
139
        iPort = iPort.to_i
140
      elsif ! iPort.kind_of?(Integer)
141
        raise ArgumentError, 'E_PORT_IS_NOT_AN_INTEGER'
142
      end
143
      sBaseUrl = "#{sProtocol}://#{sHostname}"
@@ 131-131 (lines=1) @@
128
      elsif sHostname.is_a?(String)
129
        sHostname.strip!
130
        if sHostname.length < 1
131
          sHostname = 'localhost'
132
        end
133
      else
134
        raise ArgumentError, 'E_HOSTNAME_IS_NOT_A_STRING'