Class: WikiContent::Version
- Inherits:
 - 
      Object
      
        
- Object
 - WikiContent::Version
 
 
- Defined in:
 - app/models/wiki_content.rb
 
Instance Method Summary collapse
- #attachments ⇒ Object
 - 
  
    
      #current_version?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Return true if the content is the current page content.
 - 
  
    
      #next  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the next version or nil.
 - 
  
    
      #previous  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the previous version or nil.
 - #project ⇒ Object
 - #text ⇒ Object
 - #text=(plain) ⇒ Object
 
Instance Method Details
#attachments ⇒ Object
Deprecated. 
  Removed at 4.0.0
      121 122 123  | 
    
      # File 'app/models/wiki_content.rb', line 121 def page.nil? ? [] : page. end  | 
  
#current_version? ⇒ Boolean
Deprecated. 
Removed at 4.0.0
Return true if the content is the current page content
      126 127 128  | 
    
      # File 'app/models/wiki_content.rb', line 126 def current_version? page.content.version == self.version end  | 
  
#next ⇒ Object
Deprecated. 
Removed at 4.0.0
Returns the next version or nil
      139 140 141 142 143 144  | 
    
      # File 'app/models/wiki_content.rb', line 139 def next @next ||= WikiContent::Version. reorder('version ASC'). includes(:author). where("wiki_content_id = ? AND version > ?", wiki_content_id, version).first end  | 
  
#previous ⇒ Object
Deprecated. 
Removed at 4.0.0
Returns the previous version or nil
      131 132 133 134 135 136  | 
    
      # File 'app/models/wiki_content.rb', line 131 def previous @previous ||= WikiContent::Version. reorder('version DESC'). includes(:author). where("wiki_content_id = ? AND version < ?", wiki_content_id, version).first end  | 
  
#project ⇒ Object
Deprecated. 
  Removed at 4.0.0
      117 118 119  | 
    
      # File 'app/models/wiki_content.rb', line 117 def project page.project end  | 
  
#text ⇒ Object
Deprecated. 
  Removed at 4.0.0
      103 104 105 106 107 108 109 110 111 112 113 114 115  | 
    
      # File 'app/models/wiki_content.rb', line 103 def text @text ||= begin str = case compression when 'gzip' Zlib::Inflate.inflate(data) else # uncompressed data data end str.force_encoding("UTF-8") str end end  | 
  
#text=(plain) ⇒ Object
Deprecated. 
  Removed at 4.0.0
      86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101  | 
    
      # File 'app/models/wiki_content.rb', line 86 def text=(plain) case Setting.wiki_compression when 'gzip' begin self.data = Zlib::Deflate.deflate(plain, Zlib::BEST_COMPRESSION) self.compression = 'gzip' rescue self.data = plain self.compression = '' end else self.data = plain self.compression = '' end plain end  |