arena 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ module Arena
13
13
  include Arena::Connectable
14
14
 
15
15
  attr_reader :id, :title, :generated_title, :state, :comment_count, :content,
16
- :content_html, :description, :description_html, :position, :selected
16
+ :content_html, :description, :description_html
17
17
 
18
18
  def user
19
19
  @user ||= Arena::User.new(@attrs['user'])
@@ -32,6 +32,12 @@ module Arena
32
32
  def collaborators
33
33
  @collaborators ||= @attrs['collaborators'].collect { |user| Arena::User.new(user) }
34
34
  end
35
+
36
+ %w(image text link media attachment channel).each do |kind|
37
+ define_method "#{kind}s" do
38
+ contents.select { |connectable| connectable._class.downcase == kind }
39
+ end
40
+ end
35
41
 
36
42
  end
37
43
  end
@@ -2,7 +2,19 @@ require 'time'
2
2
 
3
3
  module Arena
4
4
  module Connectable
5
- attr_reader :connection_id
5
+
6
+ %w(position selected connection_id).each do |method|
7
+ define_method method do
8
+ instance_variable_set("@#{method}", @attrs[method]) unless instance_variable_get "@#{method}"
9
+ instance_variable_get "@#{method}"
10
+ end
11
+ end
12
+
13
+ %w(image text link media attachment channel).each do |kind|
14
+ define_method "is_#{kind}?" do
15
+ _class == kind.to_s.capitalize
16
+ end
17
+ end
6
18
 
7
19
  def connected_at
8
20
  @connected_at ||= Time.parse(@attrs['connected_at']) if connected?
@@ -1,5 +1,5 @@
1
1
  module Arena
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
 
4
4
  def self.version
5
5
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arena
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-20 00:00:00.000000000 Z
12
+ date: 2013-01-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake