Module: ActsAsCleoConnection::InstanceMethods
- Defined in:
- lib/acts_as_cleo_connection/instance_methods.rb
Instance Method Summary collapse
- #create_cleo_connection ⇒ Object
- #disable_cleo_connection ⇒ Object
- #remove_cleo_connection ⇒ Object
- #to_cleo_connection ⇒ Object (also: #as_connection)
- #update_cleo_connection ⇒ Object
Instance Method Details
#create_cleo_connection ⇒ Object
3 4 5 |
# File 'lib/acts_as_cleo_connection/instance_methods.rb', line 3 def create_cleo_connection Cleo::ConnectionServer.create(self) end |
#disable_cleo_connection ⇒ Object
15 16 17 |
# File 'lib/acts_as_cleo_connection/instance_methods.rb', line 15 def disable_cleo_connection Cleo::ConnectionServer.disable(self) end |
#remove_cleo_connection ⇒ Object
11 12 13 |
# File 'lib/acts_as_cleo_connection/instance_methods.rb', line 11 def remove_cleo_connection Cleo::ConnectionServer.delete(self) end |
#to_cleo_connection ⇒ Object Also known as: as_connection
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/acts_as_cleo_connection/instance_methods.rb', line 19 def to_cleo_connection source = self.send("#{cleo_origin}") target = self.send("#{cleo_target}") type = self.respond_to?("#{cleo_type}") ? self.send("#{cleo_type}") : cleo_type return nil if target.blank? || source.blank? is_active = self.respond_to?(:active) ? self.active : nil str = target.cleo_score + source.cleo_score result = Cleo::Xml::Connection.new result.source = source.cleo_id result.target = target.cleo_id result.active = is_active result.strength = str result.type = type return result end |
#update_cleo_connection ⇒ Object
7 8 9 |
# File 'lib/acts_as_cleo_connection/instance_methods.rb', line 7 def update_cleo_connection Cleo::ConnectionServer.update(self) end |