Class: Strings::Case::Configuration Private

Inherits:
Object
  • Object
show all
Defined in:
lib/strings/case/configuration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Responsible for storing acronyms configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Create a Configuration instance

Examples:

configuration = Strings::Case::Cofiguration.new


27
28
29
# File 'lib/strings/case/configuration.rb', line 27

def initialize
  @acronyms = Acronyms.new
end

Instance Attribute Details

#acronymsStrings::Case::Acronyms (readonly)

All the registered acronyms

Examples:

configuration.acronyms

Returns:



19
20
21
# File 'lib/strings/case/configuration.rb', line 19

def acronyms
  @acronyms
end

Instance Method Details

#acronym(*names) ⇒ void

This method returns an undefined value.

Add an acronym

Examples:

strings = Strings::Case.new
strings.configure do |config|
  config.acronym "HTTP"
end
strings.pascalcase("http_response")    # => "HTTPResponse"
strings.camelcase("http_response")     # => "HTTPResponse"
strings.snakecase("HTTPResponse")      # => "http_response"
strings.titlecase("http_response")     # => "HTTP Response"
strings.sentencecase("http_response")  # => "HTTP response"

Parameters:

  • names (Array<String>)

    the names to add to the acronyms list



50
51
52
# File 'lib/strings/case/configuration.rb', line 50

def acronym(*names)
  names.each { |name| @acronyms << name }
end