Class: Arena::Channel

Inherits:
Base
  • Object
show all
Includes:
Connectable, Creatable
Defined in:
lib/arena/channel.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods included from Connectable

#connected_at, #connected_by, #connected_by_different_user?, #connections, #is_block?, #user

Methods included from Creatable

#created_at, #updated_at

Methods inherited from Base

attr_reader, #initialize

Constructor Details

This class inherits a constructor from Arena::Base

Instance Attribute Details

#collaborationObject (readonly)

Returns the value of attribute collaboration.



12
13
14
# File 'lib/arena/channel.rb', line 12

def collaboration
  @collaboration
end

#current_pageObject (readonly)

Returns the value of attribute current_page.



12
13
14
# File 'lib/arena/channel.rb', line 12

def current_page
  @current_page
end

#follower_countObject (readonly)

Returns the value of attribute follower_count.



12
13
14
# File 'lib/arena/channel.rb', line 12

def follower_count
  @follower_count
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/arena/channel.rb', line 12

def id
  @id
end

#kindObject (readonly)

Returns the value of attribute kind.



12
13
14
# File 'lib/arena/channel.rb', line 12

def kind
  @kind
end

#lengthObject (readonly)

Returns the value of attribute length.



12
13
14
# File 'lib/arena/channel.rb', line 12

def length
  @length
end

#openObject (readonly)

Returns the value of attribute open.



12
13
14
# File 'lib/arena/channel.rb', line 12

def open
  @open
end

#perObject (readonly)

Returns the value of attribute per.



12
13
14
# File 'lib/arena/channel.rb', line 12

def per
  @per
end

#publishedObject (readonly)

Returns the value of attribute published.



12
13
14
# File 'lib/arena/channel.rb', line 12

def published
  @published
end

#slugObject (readonly)

Returns the value of attribute slug.



12
13
14
# File 'lib/arena/channel.rb', line 12

def slug
  @slug
end

#statusObject (readonly)

Returns the value of attribute status.



12
13
14
# File 'lib/arena/channel.rb', line 12

def status
  @status
end

#titleObject (readonly)

Returns the value of attribute title.



12
13
14
# File 'lib/arena/channel.rb', line 12

def title
  @title
end

#total_pagesObject (readonly)

Returns the value of attribute total_pages.



12
13
14
# File 'lib/arena/channel.rb', line 12

def total_pages
  @total_pages
end

#user_idObject (readonly)

Returns the value of attribute user_id.



12
13
14
# File 'lib/arena/channel.rb', line 12

def user_id
  @user_id
end

Instance Method Details

#_base_classObject



20
21
22
# File 'lib/arena/channel.rb', line 20

def _base_class
  @attrs['base_class']
end

#_classObject



16
17
18
# File 'lib/arena/channel.rb', line 16

def _class
  @attrs['class']
end

#blocksObject



54
55
56
# File 'lib/arena/channel.rb', line 54

def blocks
  contents.select { |connectable| connectable._base_class == "Block" }
end

#collaboratorsObject



36
37
38
# File 'lib/arena/channel.rb', line 36

def collaborators
  @collaborators ||= @attrs['collaborators'].collect { |user| Arena::User.new(user) }
end

#connection_countObject



32
33
34
# File 'lib/arena/channel.rb', line 32

def connection_count
  @connection_count ||= contents.collect(&:connections).flatten.size
end

#contentsObject



24
25
26
# File 'lib/arena/channel.rb', line 24

def contents
  @contents ||= @attrs['contents'].collect { |object| "Arena::#{object['class']}".constantize.new(object) }
end

#contents_updated_atObject



28
29
30
# File 'lib/arena/channel.rb', line 28

def contents_updated_at
  # todo
end

#contributorsObject



40
41
42
# File 'lib/arena/channel.rb', line 40

def contributors
  @contributors ||= contents.collect(&:user).uniq(&:id)
end

#flat_connectionsObject



44
45
46
# File 'lib/arena/channel.rb', line 44

def flat_connections
  @flat_connections ||= contents.collect(&:connections).flatten.compact.uniq(&:id)
end