Module: Appfuel::Domain::DomainNameParser
- Included in:
- Repository::Criteria
- Defined in:
- lib/appfuel/domain/domain_name_parser.rb
Instance Method Summary collapse
-
#parse_domain_attr(name) ⇒ Array
This parse the domain attributes string and returns an array with two elements.
-
#parse_domain_name(name) ⇒ Array
This parse the domain name string or object with domain_name method and returns an array with feature, domain and name.
Instance Method Details
#parse_domain_attr(name) ⇒ Array
This parse the domain attributes string and returns an array with two elements.
38 39 40 41 42 43 44 45 |
# File 'lib/appfuel/domain/domain_name_parser.rb', line 38 def parse_domain_attr(name) unless name.is_a?(String) fail 'domain attribute name must be a string' end *first, last = name.split('.') [first.join('.'), last] end |
#parse_domain_name(name) ⇒ Array
This parse the domain name string or object with domain_name method and returns an array with feature, domain and name.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/appfuel/domain/domain_name_parser.rb', line 15 def parse_domain_name(name) if !name.is_a?(String) && !name.respond_to?(:domain_name) fail 'domain name must be a string or implement method :domain_name' end name = name.domain_name if name.respond_to?(:domain_name) feature, domain = name.split('.') if domain.nil? fail "domain names must be in the form of (<feature|global>.domain)" end [feature, domain, name] end |