Class: String

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

Instance Method Summary collapse

Instance Method Details

#to_attr_nameObject



68
69
70
# File 'lib/git/lighttp/extensions.rb', line 68

def to_attr_name
  self.split("::").last.gsub(/(.)([A-Z])/){"#{$1}_#{$2.downcase}"}.downcase
end

#to_semver_hObject



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/git/lighttp/extensions.rb', line 55

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