Class: Towsta::Kinds::UserKind

Inherits:
MainKind
  • Object
show all
Defined in:
lib/towsta/kinds/user.rb

Instance Attribute Summary

Attributes inherited from MainKind

#content

Instance Method Summary collapse

Methods inherited from MainKind

#compare_parameterized, #initialize, #kind

Constructor Details

This class inherits a constructor from Towsta::Kinds::MainKind

Instance Method Details

#compare(object) ⇒ Object



18
19
20
21
# File 'lib/towsta/kinds/user.rb', line 18

def compare object
  return self.get.id.to_i == object.id.to_i if object.class == User
  self.get.id.to_i == object.to_i
end

#exportObject



23
24
25
26
# File 'lib/towsta/kinds/user.rb', line 23

def export
  return get.id.to_s if get.class == User
  get.to_s
end

#getObject



6
7
8
9
10
# File 'lib/towsta/kinds/user.rb', line 6

def get
  return nil unless @content
  return @content if @content.class == User
  @content = User.find_by_id @content
end

#set(content) ⇒ Object



12
13
14
15
16
# File 'lib/towsta/kinds/user.rb', line 12

def set content
  return @content = content if content.class == User
  return @content = nil if !!(content =~ /[^0-9]/)
  return @content = content.to_i
end