Module: Qa::Authorities::AuthorityWithSubAuthority
- Included in:
- AssignFast, Getty, Loc, Local, Oclcts
- Defined in:
- lib/qa/authorities/authority_with_sub_authority.rb
Instance Method Summary collapse
- #new(subauthority = nil) ⇒ Object
-
#subauthorities ⇒ Object
By default, an authority has no subauthorities unless they are defined by the subclassed authority.
- #subauthority_class(name) ⇒ Object
- #subauthority_for(subauthority) ⇒ Object
- #validate_subauthority!(subauthority) ⇒ Object
Instance Method Details
#new(subauthority = nil) ⇒ Object
3 4 5 |
# File 'lib/qa/authorities/authority_with_sub_authority.rb', line 3 def new( = nil) raise "Initializing with as sub authority is removed. use #{self.class}.subauthority_for(#{.inspect}) instead" end |
#subauthorities ⇒ Object
By default, an authority has no subauthorities unless they are defined by the subclassed authority.
22 23 24 |
# File 'lib/qa/authorities/authority_with_sub_authority.rb', line 22 def [] end |
#subauthority_class(name) ⇒ Object
12 13 14 |
# File 'lib/qa/authorities/authority_with_sub_authority.rb', line 12 def (name) [self, name].join('::').classify.constantize end |
#subauthority_for(subauthority) ⇒ Object
7 8 9 10 |
# File 'lib/qa/authorities/authority_with_sub_authority.rb', line 7 def () () ().new end |
#validate_subauthority!(subauthority) ⇒ Object
16 17 18 |
# File 'lib/qa/authorities/authority_with_sub_authority.rb', line 16 def () raise Qa::InvalidSubAuthority, "Unable to initialize sub-authority #{} for #{self}. Valid sub-authorities are #{.inspect}" unless .include?() end |