arena 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/lint.yml +14 -0
- data/.github/workflows/test.yml +14 -0
- data/.rubocop.yml +12 -0
- data/.rubocop_todo.yml +49 -0
- data/Gemfile +12 -0
- data/README.md +3 -1
- data/Rakefile +9 -4
- data/arena.gemspec +16 -16
- data/lib/arena/account.rb +9 -7
- data/lib/arena/api.rb +42 -40
- data/lib/arena/base.rb +6 -5
- data/lib/arena/block.rb +5 -3
- data/lib/arena/cache/adaptor/generic.rb +3 -1
- data/lib/arena/cache/adaptor/null.rb +4 -2
- data/lib/arena/cache/adaptor/padrino.rb +3 -1
- data/lib/arena/cache/adaptor/rails.rb +7 -5
- data/lib/arena/cache.rb +11 -9
- data/lib/arena/channel.rb +8 -6
- data/lib/arena/channel_feed.rb +9 -8
- data/lib/arena/client.rb +26 -17
- data/lib/arena/comment.rb +7 -5
- data/lib/arena/configurable.rb +15 -13
- data/lib/arena/connectable.rb +21 -13
- data/lib/arena/connection.rb +6 -4
- data/lib/arena/core_ext/string.rb +7 -3
- data/lib/arena/creatable.rb +3 -3
- data/lib/arena/default.rb +9 -7
- data/lib/arena/entities/attachment.rb +4 -2
- data/lib/arena/entities/avatar.rb +8 -6
- data/lib/arena/entities/embed.rb +7 -5
- data/lib/arena/entities/image.rb +7 -2
- data/lib/arena/entities/provider.rb +2 -0
- data/lib/arena/entities/source.rb +2 -0
- data/lib/arena/entities/version.rb +2 -0
- data/lib/arena/entity.rb +2 -0
- data/lib/arena/error/cache_error.rb +4 -2
- data/lib/arena/error.rb +2 -0
- data/lib/arena/feed.rb +19 -18
- data/lib/arena/group.rb +6 -4
- data/lib/arena/results.rb +3 -1
- data/lib/arena/search_results.rb +16 -11
- data/lib/arena/story.rb +18 -15
- data/lib/arena/summary.rb +4 -2
- data/lib/arena/user.rb +12 -10
- data/lib/arena/user_feed.rb +9 -8
- data/lib/arena/version.rb +3 -1
- data/lib/arena.rb +12 -14
- data/test/cassettes/Arena/channel/handles_a_400_error_that_returns_JSON.yml +39 -0
- data/test/cassettes/Arena/channel/handles_a_403_error.yml +39 -0
- data/test/cassettes/Arena/channel/returns_a_channel.yml +118 -0
- data/test/lib/arena/api_test.rb +24 -0
- data/test/lib/arena/version_test.rb +4 -4
- data/test/test_helper.rb +20 -1
- metadata +18 -43
data/lib/arena/client.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'arena/configurable'
|
4
|
+
require 'arena/error'
|
5
|
+
require 'arena/api'
|
6
|
+
require 'httparty'
|
7
|
+
require 'json'
|
6
8
|
|
7
9
|
module Arena
|
8
10
|
class Client
|
@@ -10,7 +12,7 @@ module Arena
|
|
10
12
|
include Arena::Configurable
|
11
13
|
include Arena::API
|
12
14
|
|
13
|
-
def initialize(options={})
|
15
|
+
def initialize(options = {})
|
14
16
|
Arena::Configurable.keys.each do |key|
|
15
17
|
instance_variable_set(:"@#{key}", options[key] || Arena.instance_variable_get(:"@#{key}"))
|
16
18
|
end
|
@@ -18,23 +20,23 @@ module Arena
|
|
18
20
|
|
19
21
|
# Performs HTTP GET POST PUT and DELETE requests
|
20
22
|
#
|
21
|
-
%w
|
22
|
-
define_method method do |path, options={}|
|
23
|
+
%w[get post put delete].each do |method|
|
24
|
+
define_method method do |path, options = {}|
|
23
25
|
options = { query: options, headers: set_headers }
|
24
26
|
|
25
27
|
request(__method__, path, options)
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
|
-
|
31
|
+
private
|
30
32
|
|
31
33
|
def set_headers
|
32
34
|
if !@access_token.nil?
|
33
|
-
{
|
35
|
+
{ 'Authorization' => "Bearer #{@access_token}" }
|
34
36
|
elsif !@auth_token.nil?
|
35
|
-
{
|
37
|
+
{ 'X-AUTH-TOKEN' => @auth_token }
|
36
38
|
else
|
37
|
-
{
|
39
|
+
{}
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
@@ -47,14 +49,21 @@ module Arena
|
|
47
49
|
end
|
48
50
|
|
49
51
|
def request(method, path, options)
|
50
|
-
response = self.class.send(method, "
|
51
|
-
|
52
|
+
response = self.class.send(method, "https://#{@base_domain}/#{@api_version}#{path}", options)
|
53
|
+
|
54
|
+
parsed = if response.content_type&.include?('application/json')
|
55
|
+
begin
|
56
|
+
JSON.parse(response.body)
|
57
|
+
rescue JSON::ParserError, TypeError
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
else
|
61
|
+
response.body
|
62
|
+
end
|
52
63
|
|
53
|
-
raise Arena::Error
|
64
|
+
raise Arena::Error, error_message(parsed) if error?(response)
|
54
65
|
|
55
66
|
parsed
|
56
|
-
rescue JSON::ParserError, TypeError
|
57
|
-
nil
|
58
67
|
end
|
59
68
|
end
|
60
69
|
end
|
data/lib/arena/comment.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'arena/base'
|
4
|
+
require 'arena/user'
|
5
|
+
require 'arena/creatable'
|
4
6
|
|
5
7
|
module Arena
|
6
8
|
class Comment < Arena::Base
|
@@ -9,11 +11,11 @@ module Arena
|
|
9
11
|
attr_reader :id, :commentable_id, :commentable_type, :body
|
10
12
|
|
11
13
|
def _class
|
12
|
-
@_class ||= @attrs[
|
14
|
+
@_class ||= @attrs['class']
|
13
15
|
end
|
14
16
|
|
15
17
|
def user
|
16
|
-
@user ||= Arena::User.new(@attrs[
|
18
|
+
@user ||= Arena::User.new(@attrs['user'])
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
data/lib/arena/configurable.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arena
|
2
4
|
module Configurable
|
3
5
|
attr_accessor :base_domain,
|
@@ -12,21 +14,21 @@ module Arena
|
|
12
14
|
|
13
15
|
class << self
|
14
16
|
def keys
|
15
|
-
@keys ||= [
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
@keys ||= %i[
|
18
|
+
base_domain
|
19
|
+
api_version
|
20
|
+
application_id
|
21
|
+
application_secret
|
22
|
+
access_token
|
23
|
+
auth_token
|
24
|
+
use_caching
|
25
|
+
expires_in
|
24
26
|
]
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
# Allows configuration options to be set in a block
|
29
|
-
#
|
31
|
+
#
|
30
32
|
def configure
|
31
33
|
yield self
|
32
34
|
|
@@ -37,16 +39,16 @@ module Arena
|
|
37
39
|
Arena::Configurable.keys.each do |key|
|
38
40
|
instance_variable_set(:"@#{key}", Arena::Default.options[key])
|
39
41
|
end
|
40
|
-
|
42
|
+
|
41
43
|
self
|
42
44
|
end
|
43
45
|
|
44
46
|
alias setup reset!
|
45
47
|
|
46
|
-
|
48
|
+
private
|
47
49
|
|
48
50
|
def options
|
49
|
-
|
51
|
+
Arena::Configurable.keys.to_h { |key| [key, instance_variable_get(:"@#{key}")] }
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
data/lib/arena/connectable.rb
CHANGED
@@ -1,37 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'time'
|
2
4
|
|
3
5
|
module Arena
|
4
6
|
module Connectable
|
5
7
|
def user
|
6
|
-
@user ||= Arena::User.new(@attrs['user'])
|
8
|
+
@user ||= Arena::User.new(@attrs['user']) unless @attrs['user'].nil?
|
7
9
|
end
|
8
10
|
|
9
|
-
%w
|
11
|
+
%w[position selected connection_id].each do |method|
|
10
12
|
define_method method do
|
11
13
|
instance_variable_set("@#{method}", @attrs[method]) unless instance_variable_get "@#{method}"
|
12
14
|
instance_variable_get "@#{method}"
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
|
-
%w
|
18
|
+
%w[image text link media attachment channel].each do |kind|
|
17
19
|
define_method "is_#{kind}?" do
|
18
20
|
_class == kind.to_s.capitalize
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
24
|
# Detect optional portions of the response
|
23
|
-
%w
|
25
|
+
%w[image attachment embed].each do |kind|
|
24
26
|
define_method "has_#{kind}?" do
|
25
27
|
!@attrs[kind.to_s].nil?
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
31
|
def is_block?
|
30
|
-
_base_class ==
|
32
|
+
_base_class == 'Block'
|
31
33
|
end
|
32
34
|
|
33
35
|
def connections
|
34
|
-
|
36
|
+
return if @attrs['connections'].nil?
|
37
|
+
|
38
|
+
@connections ||= @attrs['connections'].collect do |channel|
|
39
|
+
Arena::Channel.new(channel)
|
40
|
+
end
|
35
41
|
end
|
36
42
|
|
37
43
|
def connected_at
|
@@ -43,17 +49,19 @@ module Arena
|
|
43
49
|
end
|
44
50
|
|
45
51
|
def connected_by
|
52
|
+
return unless connected?
|
53
|
+
|
46
54
|
@connected_by ||= Arena::User.new({
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
55
|
+
'id' => @attrs['connected_by_user_id'],
|
56
|
+
'username' => @attrs['connected_by_username'],
|
57
|
+
'full_name' => @attrs['connected_by_username']
|
58
|
+
})
|
51
59
|
end
|
52
60
|
|
53
|
-
|
61
|
+
private
|
54
62
|
|
55
63
|
def connected?
|
56
64
|
!@attrs['connected_at'].nil?
|
57
65
|
end
|
58
|
-
end
|
59
|
-
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/arena/connection.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'arena/base'
|
2
4
|
|
3
5
|
module Arena
|
4
6
|
class Connection < Arena::Base
|
5
7
|
include Arena::Creatable
|
6
8
|
|
7
9
|
attr_reader :id, :position, :selected, :user_id,
|
8
|
-
|
9
|
-
end
|
10
|
-
end
|
10
|
+
:connectable_id, :connectable_type, :channel_id
|
11
|
+
end
|
12
|
+
end
|
@@ -1,5 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class String
|
2
|
-
|
3
|
-
|
4
|
-
|
4
|
+
unless method_defined?(:constantize)
|
5
|
+
def constantize
|
6
|
+
split('::').inject(Module) { |acc, val| acc.const_get(val) }
|
7
|
+
end
|
8
|
+
end
|
5
9
|
end
|
data/lib/arena/creatable.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'time'
|
2
4
|
|
3
5
|
module Arena
|
4
6
|
module Creatable
|
5
|
-
|
6
7
|
# Time when the object was created on Arena
|
7
8
|
#
|
8
9
|
# @return [Time]
|
@@ -17,7 +18,7 @@ module Arena
|
|
17
18
|
@updated_at ||= Time.parse(@attrs['updated_at']) if updated?
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
+
private
|
21
22
|
|
22
23
|
def created?
|
23
24
|
!@attrs['created_at'].nil?
|
@@ -26,6 +27,5 @@ module Arena
|
|
26
27
|
def updated?
|
27
28
|
!@attrs['updated_at'].nil?
|
28
29
|
end
|
29
|
-
|
30
30
|
end
|
31
31
|
end
|
data/lib/arena/default.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arena
|
2
4
|
module Default
|
3
|
-
BASE_DOMAIN =
|
4
|
-
API_VERSION =
|
5
|
+
BASE_DOMAIN = 'api.are.na' unless defined? BASE_DOMAIN
|
6
|
+
API_VERSION = 'v2' unless defined? API_VERSION
|
5
7
|
USE_CACHING = false unless defined? USE_CACHING
|
6
8
|
EXPIRES_IN = 600 unless defined? EXPIRES_IN # 10 minutes
|
7
9
|
|
8
10
|
class << self
|
9
11
|
def options
|
10
|
-
|
12
|
+
Arena::Configurable.keys.to_h { |key| [key, send(key)] }
|
11
13
|
end
|
12
14
|
|
13
15
|
def api_version
|
@@ -19,19 +21,19 @@ module Arena
|
|
19
21
|
end
|
20
22
|
|
21
23
|
def application_id
|
22
|
-
ENV
|
24
|
+
ENV.fetch('APPLICATION_ID', nil)
|
23
25
|
end
|
24
26
|
|
25
27
|
def application_secret
|
26
|
-
ENV
|
28
|
+
ENV.fetch('APPLICATION_SECRET', nil)
|
27
29
|
end
|
28
30
|
|
29
31
|
def access_token
|
30
|
-
ENV
|
32
|
+
ENV.fetch('APPLICATION_SECRET', nil)
|
31
33
|
end
|
32
34
|
|
33
35
|
def auth_token
|
34
|
-
ENV
|
36
|
+
ENV.fetch('AUTH_TOKEN', nil)
|
35
37
|
end
|
36
38
|
|
37
39
|
def use_caching
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'arena/entity'
|
2
4
|
require 'arena/entities/version'
|
3
5
|
|
@@ -5,7 +7,7 @@ module Arena
|
|
5
7
|
class Entity
|
6
8
|
class Attachment < Arena::Entity
|
7
9
|
attr_reader :file_name, :file_size, :file_size_display,
|
8
|
-
|
10
|
+
:content_type, :extension, :url
|
9
11
|
end
|
10
12
|
end
|
11
|
-
end
|
13
|
+
end
|
@@ -1,13 +1,15 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'arena/entity'
|
2
4
|
|
3
5
|
module Arena
|
4
6
|
class Entity
|
5
7
|
class Avatar < Arena::Entity
|
6
8
|
attr_reader :thumb, :display
|
7
9
|
|
8
|
-
def custom(size=40)
|
9
|
-
thumb.gsub(
|
10
|
+
def custom(size = 40)
|
11
|
+
thumb.gsub('s=40', "s=#{size}")
|
10
12
|
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/arena/entities/embed.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'arena/entity'
|
2
4
|
|
3
5
|
module Arena
|
4
6
|
class Entity
|
5
7
|
class Embed < Arena::Entity
|
6
8
|
attr_reader :embed, :url, :type, :title, :author_name, :author_url,
|
7
|
-
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
9
|
+
:source_url, :thumbnail_url, :width, :height, :html
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/arena/entities/image.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'arena/creatable'
|
2
4
|
require 'arena/entity'
|
3
5
|
require 'arena/entities/version'
|
@@ -9,9 +11,12 @@ module Arena
|
|
9
11
|
|
10
12
|
attr_reader :filename, :content_type
|
11
13
|
|
12
|
-
%w
|
14
|
+
%w[thumb square display large original].each do |method|
|
13
15
|
define_method method do
|
14
|
-
|
16
|
+
unless instance_variable_get "@#{method}"
|
17
|
+
instance_variable_set("@#{method}",
|
18
|
+
Arena::Entity::Version.new(@attrs[method]))
|
19
|
+
end
|
15
20
|
instance_variable_get "@#{method}"
|
16
21
|
end
|
17
22
|
end
|
data/lib/arena/entity.rb
CHANGED
data/lib/arena/error.rb
CHANGED
data/lib/arena/feed.rb
CHANGED
@@ -1,36 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'arena/base'
|
4
|
+
require 'arena/story'
|
5
|
+
require 'arena/group'
|
4
6
|
|
5
7
|
module Arena
|
6
8
|
class Feed < Arena::Base
|
7
9
|
attr_reader :type, :limit, :total, :offset, :range_start, :range_end
|
8
10
|
|
9
11
|
def stories
|
10
|
-
@stories ||= @attrs[
|
12
|
+
@stories ||= @attrs['items'].collect { |item| Arena::Story.new(item) } if stories?
|
11
13
|
end
|
12
|
-
|
14
|
+
|
13
15
|
alias items stories
|
14
16
|
|
15
17
|
def groups
|
16
|
-
|
17
|
-
groups = items.group_by do |item|
|
18
|
-
target = "#{item.target.id}_" if !item.target.nil?
|
18
|
+
return unless stories?
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
groups = items.group_by do |item|
|
21
|
+
target = "#{item.target.id}_" unless item.target.nil?
|
22
22
|
|
23
|
-
|
24
|
-
groups.collect { |key, stories| Arena::Group.new(key, stories) }.
|
25
|
-
sort_by { |group| group.summary.indicative.created_at }.reverse!
|
23
|
+
"#{item.user.id}_#{target}#{item.action.gsub(' ', '_')}"
|
26
24
|
end
|
25
|
+
|
26
|
+
@groups ||=
|
27
|
+
groups.collect { |key, stories| Arena::Group.new(key, stories) }
|
28
|
+
.sort_by { |group| group.summary.indicative.created_at }.reverse!
|
27
29
|
end
|
28
30
|
|
29
|
-
|
31
|
+
private
|
30
32
|
|
31
33
|
def stories?
|
32
|
-
!@attrs[
|
34
|
+
!@attrs['items'].nil?
|
33
35
|
end
|
34
|
-
|
35
|
-
|
36
|
-
end # Arena
|
36
|
+
end
|
37
|
+
end
|
data/lib/arena/group.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'arena/story'
|
4
|
+
require 'arena/summary'
|
3
5
|
|
4
6
|
module Arena
|
5
7
|
class Group
|
@@ -17,5 +19,5 @@ module Arena
|
|
17
19
|
def summary
|
18
20
|
@summary ||= Arena::Summary.new(stories)
|
19
21
|
end
|
20
|
-
end
|
21
|
-
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/arena/results.rb
CHANGED
data/lib/arena/search_results.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'arena/core_ext/string'
|
4
|
+
require 'arena/base'
|
5
|
+
require 'arena/channel'
|
6
|
+
require 'arena/user'
|
7
|
+
require 'arena/block'
|
6
8
|
|
7
9
|
module Arena
|
8
10
|
class SearchResults < Arena::Base
|
@@ -13,13 +15,16 @@ module Arena
|
|
13
15
|
:length,
|
14
16
|
:authenticated
|
15
17
|
|
16
|
-
%w
|
18
|
+
%w[user channel block].each do |method|
|
17
19
|
define_method "#{method}s" do
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
unless instance_variable_get "@#{method}s"
|
21
|
+
instance_variable_set("@#{method}s",
|
22
|
+
@attrs["#{method}s"].collect do |element|
|
23
|
+
"Arena::#{method.capitalize}".constantize.new(element)
|
24
|
+
end)
|
25
|
+
end
|
21
26
|
instance_variable_get "@#{method}s"
|
22
27
|
end
|
23
28
|
end
|
24
|
-
end
|
25
|
-
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/arena/story.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'arena/base'
|
4
|
+
require 'arena/creatable'
|
5
|
+
require 'arena/user'
|
6
|
+
require 'arena/block'
|
7
|
+
require 'arena/channel'
|
8
|
+
require 'arena/connection'
|
7
9
|
|
8
10
|
module Arena
|
9
11
|
class Story < Arena::Base
|
@@ -12,20 +14,21 @@ module Arena
|
|
12
14
|
attr_reader :id, :action, :bulletin_id, :connector, :created_at
|
13
15
|
|
14
16
|
def user
|
15
|
-
@user ||= Arena::User.new(@attrs[
|
17
|
+
@user ||= Arena::User.new(@attrs['user'])
|
16
18
|
end
|
17
19
|
|
18
|
-
%w
|
20
|
+
%w[item target parent].each do |method|
|
19
21
|
define_method method do
|
20
|
-
if
|
21
|
-
|
22
|
+
return if @attrs[method].nil?
|
23
|
+
|
24
|
+
type = "#{method}_type"
|
22
25
|
|
26
|
+
unless instance_variable_get "@#{method}"
|
23
27
|
instance_variable_set("@#{method}",
|
24
|
-
|
25
|
-
) unless instance_variable_get "@#{method}"
|
26
|
-
instance_variable_get "@#{method}"
|
28
|
+
"Arena::#{@attrs[type]}".constantize.new(@attrs[method]))
|
27
29
|
end
|
30
|
+
instance_variable_get "@#{method}"
|
28
31
|
end
|
29
32
|
end
|
30
|
-
end
|
31
|
-
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/arena/summary.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arena
|
2
4
|
class Summary
|
3
5
|
attr_reader :indicative, :kinds, :size
|
@@ -7,5 +9,5 @@ module Arena
|
|
7
9
|
@kinds = stories.collect { |story| story.item._class }.uniq
|
8
10
|
@size = stories.size
|
9
11
|
end
|
10
|
-
end
|
11
|
-
end
|
12
|
+
end
|
13
|
+
end
|