Class: String

Inherits:
Object show all
Defined in:
lib/git/lighttp/extensions.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#to_attr_nameObject



64
65
66
67
68
# File 'lib/git/lighttp/extensions.rb', line 64

def to_attr_name
  split('::').last.gsub(/(?<obj>.)(?<action>[A-Z])/) do
    [obj, access.downcase].join('_')
  end.downcase
end

#to_semver_hObject



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/git/lighttp/extensions.rb', line 51

def to_semver_h
  tags   = [:major, :minor, :patch, :status]
  values = split('.').map do |key|
    # Check pre-release status
    if key =~ /^(?<minor>\d{1,})(?<status>[a-z]+[\d\w]{1,}.*)$/i
      [minor.to_i, status]
    else
      key.to_i
    end
  end.flatten
  Hash[tags.zip(values)]
end