Class: String
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#to_attr_name ⇒ Object
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_h ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/git/lighttp/extensions.rb', line 51 def to_semver_h = [: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[.zip(values)] end |