Sha256: 0f962585f69e538271d73b3ddd39d601f84b381c9c98ad25a971e03e9c97445d
Contents?: true
Size: 574 Bytes
Versions: 6
Compression:
Stored size: 574 Bytes
Contents
# frozen_string_literal: true require 'immutable-struct' module RubyNPM module Options class Name < ImmutableStruct.new(:name) def initialize(name) super(name: name.to_s) end def name "--#{without_prefix}" end alias to_s name def as_singular_key snake_case.to_sym end def as_plural_key :"#{snake_case}s" end private def without_prefix @name.sub(/^-+/, '') end def snake_case without_prefix.gsub('-', '_') end end end end
Version data entries
6 entries across 6 versions & 1 rubygems