Class: Lattice::Resource
- Inherits:
 - 
      Webmachine::Resource
      
        
- Object
 - Webmachine::Resource
 - Lattice::Resource
 
 
- Includes:
 - Celluloid::Logger
 
- Defined in:
 - lib/lattice/resource.rb
 
Class Method Summary collapse
- .accept_content_type(content_types) ⇒ Object (also: accept)
 - .allow_method(*methods) ⇒ Object (also: allow)
 - .provide_content_type(content_types) ⇒ Object
 - .provide_encoding(encodings) ⇒ Object
 
Instance Method Summary collapse
- #allowed_methods ⇒ Object
 - #content_types_accepted ⇒ Object
 - #content_types_provided ⇒ Object
 - #encodings_provided ⇒ Object
 - #handle_exception(ex) ⇒ Object
 
Class Method Details
.accept_content_type(content_types) ⇒ Object Also known as: accept
      23 24 25 26 27 28  | 
    
      # File 'lib/lattice/resource.rb', line 23 def accept_content_type(content_types) content_types.each do |key, value| self.content_types_accepted ||= [] content_types_accepted << [key, value] end end  | 
  
.allow_method(*methods) ⇒ Object Also known as: allow
      17 18 19 20  | 
    
      # File 'lib/lattice/resource.rb', line 17 def allow_method(*methods) self.allowed_methods ||= [] self.allowed_methods += methods.map(&:to_s).map(&:upcase) end  | 
  
.provide_content_type(content_types) ⇒ Object
      31 32 33 34 35 36  | 
    
      # File 'lib/lattice/resource.rb', line 31 def provide_content_type(content_types) content_types.each do |key, value| self.content_types_provided ||= [] content_types_provided << [key, value] end end  | 
  
.provide_encoding(encodings) ⇒ Object
      38 39 40 41  | 
    
      # File 'lib/lattice/resource.rb', line 38 def provide_encoding(encodings) self.encodings_provided ||= {} encodings_provided.merge!(encodings) end  | 
  
Instance Method Details
#allowed_methods ⇒ Object
      44 45 46 47 48  | 
    
      # File 'lib/lattice/resource.rb', line 44 def allowed_methods methods = self.class.allowed_methods return methods if methods && !methods.empty? super end  | 
  
#content_types_accepted ⇒ Object
      50 51 52 53 54  | 
    
      # File 'lib/lattice/resource.rb', line 50 def content_types_accepted types = self.class.content_types_accepted return types if types && !types.empty? super end  | 
  
#content_types_provided ⇒ Object
      56 57 58 59 60  | 
    
      # File 'lib/lattice/resource.rb', line 56 def content_types_provided types = self.class.content_types_provided return types if types && !types.empty? super end  | 
  
#encodings_provided ⇒ Object
      62 63 64 65 66  | 
    
      # File 'lib/lattice/resource.rb', line 62 def encodings_provided encodings = self.class.encodings_provided return encodings if encodings && !encodings.empty? super end  | 
  
#handle_exception(ex) ⇒ Object
      68 69 70  | 
    
      # File 'lib/lattice/resource.rb', line 68 def handle_exception(ex) crash "#{self.class} crashed!", ex end  |