Class: Chat

Inherits:
PostType show all
Defined in:
lib/turbine-core/types/chat.rb

Constant Summary

Constants inherited from PostType

PostType::DEFAULT_FIELDS, PostType::NON_EDITABLE_FIELDS

Constants included from ClassLevelInheritableAttributes

ClassLevelInheritableAttributes::PRIMITIVES

Instance Attribute Summary

Attributes inherited from PostType

#content

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PostType

allow, auto_detect, #blank_attr?, #commit_hash, default, #default_status, #delete_attr, dynamic, #eval_defaults, fields, #fill_default_fields, #generate_slug, #get_attr, #get_attr?, get_pairs, get_pairs_count, #get_string_for, #haml, has_keys?, has_more_than?, has_more_than_one?, has_one_or_more?, has_required?, heading, html, #import, #initialize, markdown, #post_to_trackbacks, preferred_order, preferred_order=, primary, required, #sanitize_content_fields, #save, #send_to_storage, #set_attr, #set_default, #slug_is_unique, special, string_for, #to_html, #to_s, #truncate_slug, #uuid, #valid?

Methods included from ClassLevelInheritableAttributes

#cattr_inheritable, #inherited

Constructor Details

This class inherits a constructor from PostType

Class Method Details

.detect?(text) ⇒ Boolean

of commit_pairs

Returns:

  • (Boolean)


36
37
38
# File 'lib/turbine-core/types/chat.rb', line 36

def self.detect?(text)
  has_one_or_more? text, :me
end

Instance Method Details

#commit_array(pairs_array) ⇒ Object

override commit_pairs to make chat transcripts form the Me: pairs stuff



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/turbine-core/types/chat.rb', line 16

def commit_array(pairs_array)
  transcript = []
  
  pairs_array.each do |pairs_hash|
    
    pairs_hash.each do |key, value|
      
      unless self.class.allowed_fields_list.include?(key)
        transcript << { key => value }
      else
        set_attr(key, value)
      end
    end#of each
    
  end#of each
  
  set_attr(:transcript, transcript)
  
end