Class: Mingle::MingleIdentifier
- Inherits:
-
BitGirderClass
- Object
- BitGirderClass
- Mingle::MingleIdentifier
- Includes:
- StringParser
- Defined in:
- lib/mingle.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from StringParser
Class Method Details
.as_format_name(id) ⇒ Object
1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 |
# File 'lib/mingle.rb', line 1786 def self.as_format_name( id ) sym = self.get( id ).to_sym if ID_STYLES.include?( sym ) sym else raise "Unknown or invalid identifier format: #{id} (#{id.class})" end end |
Instance Method Details
#external_form ⇒ Object Also known as: to_s
1770 1771 1772 |
# File 'lib/mingle.rb', line 1770 def external_form format( :lc_hyphenated ) end |
#format(fmt) ⇒ Object
1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 |
# File 'lib/mingle.rb', line 1749 def format( fmt ) not_nil( fmt, :fmt ) case fmt when ID_STYLE_LC_HYPHENATED then @parts.join( "-" ) when ID_STYLE_LC_UNDERSCORE then @parts.join( "_" ) when ID_STYLE_LC_CAMEL_CAPPED @parts[ 0 ] + @parts[ 1 .. -1 ].map do |t| t[ 0, 1 ].upcase + t[ 1 .. -1 ] end.join else raise "Invalid format: #{fmt}" end end |
#hash ⇒ Object
1782 1783 1784 |
# File 'lib/mingle.rb', line 1782 def hash @parts.hash end |
#to_sym ⇒ Object
1777 1778 1779 |
# File 'lib/mingle.rb', line 1777 def to_sym format( :lc_underscore ).to_sym end |