Module: Subjoin::Inheritable::ClassMethods
- Defined in:
- lib/subjoin/inheritable.rb
Overview
Class methods for objects that include this mixin
Instance Method Summary collapse
-
#type_id ⇒ String
class.
-
#type_url ⇒ URI
of ROOT_URI and #type_id.
Instance Method Details
#type_id ⇒ String
class. Lower-cased name of the class unless TYPE_PATH is specified
60 61 62 63 |
# File 'lib/subjoin/inheritable.rb', line 60 def type_id return self.to_s.downcase.gsub(/^.*::/, '') if self::TYPE_PATH.nil? return self::TYPE_PATH end |
#type_url ⇒ URI
of ROOT_URI and #type_id
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/subjoin/inheritable.rb', line 67 def type_url if self.class == Resource raise Subjoin::SubclassError.new "Class must be a subclass of Resource to use this method" end if self::ROOT_URI.nil? raise Subjoin::SubclassError.new "#{self.class} or a parent of #{self.class} derived from Subjoin::Resource must override ROOT_URI to use this method" end return URI([self::ROOT_URI, self::type_id].join('/')) end |