Module: Mingle::StringParser
- Included in:
- DeclaredTypeName, MingleIdentifiedName, MingleIdentifier, MingleNamespace, MingleTypeReference, ParsedNumber, QualifiedTypeName
- Defined in:
- lib/mingle.rb
Overview
Including classes must define impl_parse() as a class method; this module will add class methods parse()/get() which can take any of PARSED_TYPES and return an instance according to impl_parse. Also installs BitGirderClass instance handlers for PARSED_TYPES
Class Method Summary collapse
Class Method Details
.included(cls) ⇒ Object
1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 |
# File 'lib/mingle.rb', line 1686 def self.included( cls ) cls.class_eval do map_instance_of( *PARSED_TYPES ) { |s| self.impl_parse( s.to_s ) } def self.get( val ) self.as_instance( val ) end def self.parse( val ) self.as_instance( val ) end end end |