Sha256: f1b373fa1fcd5436841263f8378a5a77a6244c160924f3f0b526cecd337f934d
Contents?: true
Size: 580 Bytes
Versions: 10
Compression:
Stored size: 580 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".to_sym end private def without_prefix @name.sub(/^-+/, '') end def snake_case without_prefix.gsub('-', '_') end end end end
Version data entries
10 entries across 10 versions & 1 rubygems