infopark_reactor 1.26.1 → 1.27.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +25 -0
  3. data/.rubocop_todo.yml +363 -0
  4. data/Rakefile +10 -13
  5. data/app/models/rails_connector/abstract_obj.rb +2 -1
  6. data/config/routes.rb +0 -1
  7. data/infopark_reactor.gemspec +16 -15
  8. data/lib/generators/cm/migration/migration_generator.rb +4 -8
  9. data/lib/infopark_reactor.rb +43 -69
  10. data/lib/reactor/already_released.rb +1 -2
  11. data/lib/reactor/attributes.rb +92 -268
  12. data/lib/reactor/attributes/date_serializer.rb +20 -16
  13. data/lib/reactor/attributes/html_serializer.rb +6 -5
  14. data/lib/reactor/attributes/link_list_extender.rb +10 -8
  15. data/lib/reactor/attributes/link_list_from_accessor.rb +2 -1
  16. data/lib/reactor/attributes/link_list_from_attr_values.rb +2 -1
  17. data/lib/reactor/attributes/link_list_serializer.rb +8 -7
  18. data/lib/reactor/attributes_handlers.rb +164 -0
  19. data/lib/reactor/cache/permission.rb +6 -9
  20. data/lib/reactor/cache/user.rb +3 -6
  21. data/lib/reactor/cm/attribute.rb +16 -16
  22. data/lib/reactor/cm/attribute_group.rb +18 -21
  23. data/lib/reactor/cm/blob_too_small_error.rb +2 -2
  24. data/lib/reactor/cm/bridge.rb +6 -9
  25. data/lib/reactor/cm/channel.rb +3 -4
  26. data/lib/reactor/cm/editorial_group.rb +2 -9
  27. data/lib/reactor/cm/group.rb +30 -43
  28. data/lib/reactor/cm/job.rb +23 -25
  29. data/lib/reactor/cm/language.rb +21 -22
  30. data/lib/reactor/cm/link.rb +38 -40
  31. data/lib/reactor/cm/live_group.rb +2 -9
  32. data/lib/reactor/cm/log_entry.rb +22 -21
  33. data/lib/reactor/cm/missing_credentials.rb +3 -2
  34. data/lib/reactor/cm/multi_xml_request.rb +22 -25
  35. data/lib/reactor/cm/obj.rb +159 -154
  36. data/lib/reactor/cm/obj_class.rb +52 -51
  37. data/lib/reactor/cm/object_base.rb +26 -21
  38. data/lib/reactor/cm/permissions.rb +7 -7
  39. data/lib/reactor/cm/user.rb +43 -51
  40. data/lib/reactor/cm/workflow.rb +11 -12
  41. data/lib/reactor/cm/xml_attribute.rb +10 -19
  42. data/lib/reactor/cm/xml_markup.rb +7 -10
  43. data/lib/reactor/cm/xml_multi_request_error.rb +1 -3
  44. data/lib/reactor/cm/xml_request.rb +21 -29
  45. data/lib/reactor/cm/xml_request_error.rb +1 -3
  46. data/lib/reactor/cm/xml_response.rb +8 -16
  47. data/lib/reactor/cm/xml_single_request_error.rb +3 -5
  48. data/lib/reactor/configuration.rb +1 -3
  49. data/lib/reactor/engine.rb +5 -10
  50. data/lib/reactor/legacy.rb +6 -7
  51. data/lib/reactor/link/external.rb +8 -5
  52. data/lib/reactor/link/internal.rb +8 -5
  53. data/lib/reactor/link/temporary_link.rb +16 -17
  54. data/lib/reactor/main.rb +11 -15
  55. data/lib/reactor/migration.rb +52 -53
  56. data/lib/reactor/no_working_version.rb +1 -2
  57. data/lib/reactor/not_permitted.rb +1 -2
  58. data/lib/reactor/permission.rb +36 -38
  59. data/lib/reactor/persistence.rb +104 -178
  60. data/lib/reactor/plans/common_attribute.rb +7 -7
  61. data/lib/reactor/plans/common_attribute_group.rb +6 -6
  62. data/lib/reactor/plans/common_channel.rb +6 -6
  63. data/lib/reactor/plans/common_group.rb +7 -14
  64. data/lib/reactor/plans/common_job.rb +6 -6
  65. data/lib/reactor/plans/common_obj_class.rb +11 -11
  66. data/lib/reactor/plans/create_attribute.rb +1 -3
  67. data/lib/reactor/plans/create_attribute_group.rb +1 -3
  68. data/lib/reactor/plans/create_channel.rb +2 -3
  69. data/lib/reactor/plans/create_group.rb +3 -10
  70. data/lib/reactor/plans/create_job.rb +3 -4
  71. data/lib/reactor/plans/create_obj.rb +12 -14
  72. data/lib/reactor/plans/create_obj_class.rb +1 -2
  73. data/lib/reactor/plans/delete_attribute.rb +1 -3
  74. data/lib/reactor/plans/delete_attribute_group.rb +2 -4
  75. data/lib/reactor/plans/delete_channel.rb +3 -6
  76. data/lib/reactor/plans/delete_group.rb +2 -9
  77. data/lib/reactor/plans/delete_job.rb +3 -5
  78. data/lib/reactor/plans/delete_obj.rb +3 -4
  79. data/lib/reactor/plans/delete_obj_class.rb +1 -2
  80. data/lib/reactor/plans/prepared.rb +3 -4
  81. data/lib/reactor/plans/rename_group.rb +4 -11
  82. data/lib/reactor/plans/rename_obj_class.rb +1 -2
  83. data/lib/reactor/plans/update_attribute.rb +1 -3
  84. data/lib/reactor/plans/update_attribute_group.rb +2 -4
  85. data/lib/reactor/plans/update_group.rb +2 -9
  86. data/lib/reactor/plans/update_job.rb +4 -8
  87. data/lib/reactor/plans/update_obj.rb +6 -7
  88. data/lib/reactor/plans/update_obj_class.rb +0 -2
  89. data/lib/reactor/rc_independent.rb +0 -1
  90. data/lib/reactor/session.rb +27 -31
  91. data/lib/reactor/session/observers.rb +3 -5
  92. data/lib/reactor/session/user.rb +6 -7
  93. data/lib/reactor/session_helper/auth_filter.rb +9 -0
  94. data/lib/reactor/session_helper/auth_helper.rb +24 -0
  95. data/lib/reactor/session_helper/rsession_helper.rb +16 -0
  96. data/lib/reactor/session_helper/session_state.rb +31 -0
  97. data/lib/reactor/streaming_upload.rb +0 -1
  98. data/lib/reactor/sudo.rb +2 -3
  99. data/lib/reactor/support/link_matcher.rb +8 -7
  100. data/lib/reactor/tools/migrator.rb +30 -35
  101. data/lib/reactor/tools/response_handler/xml_attribute.rb +27 -33
  102. data/lib/reactor/tools/smart_xml_logger.rb +20 -22
  103. data/lib/reactor/tools/sower.rb +22 -23
  104. data/lib/reactor/tools/uploader.rb +12 -17
  105. data/lib/reactor/tools/versioner.rb +29 -30
  106. data/lib/reactor/tools/where_query.rb +11 -14
  107. data/lib/reactor/tools/workflow_generator.rb +26 -28
  108. data/lib/reactor/tools/xml_attributes.rb +7 -14
  109. data/lib/reactor/tools/xpath_extractor.rb +2 -1
  110. data/lib/reactor/validations.rb +20 -16
  111. data/lib/reactor/version.rb +1 -2
  112. data/lib/reactor/workflow.rb +10 -33
  113. data/lib/reactor/workflow/comment.rb +28 -0
  114. data/lib/reactor/workflow/empty.rb +0 -1
  115. data/lib/reactor/workflow/standard.rb +4 -3
  116. data/lib/tasks/cm_migrate.rake +3 -3
  117. data/lib/tasks/cm_seeds.rake +9 -16
  118. metadata +64 -28
  119. data/app/models/rails_connector/abstract_model.rb +0 -7
  120. data/app/models/rails_connector/attribute.rb +0 -94
  121. data/app/models/rails_connector/blob_mapping.rb +0 -16
  122. data/app/models/rails_connector/channel.rb +0 -41
  123. data/app/models/rails_connector/content.rb +0 -12
  124. data/app/models/rails_connector/job.rb +0 -14
  125. data/app/models/rails_connector/obj_class.rb +0 -158
  126. data/app/models/rails_connector/obj_class_attr.rb +0 -5
  127. data/app/models/rails_connector/object_with_meta_data.rb +0 -18
  128. data/lib/rails_connector/meta/eager_loader.rb +0 -91
  129. data/lib/reactor/rails_connector_meta.rb +0 -149
  130. data/lib/reactor/session_helper.rb +0 -72
@@ -1,34 +1,33 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'reactor/cm/object_base'
1
+ require "reactor/cm/object_base"
3
2
 
4
3
  module Reactor
5
4
  module Cm
6
5
  class Workflow < ObjectBase
7
6
  # Attribute definitions
8
- attribute :name, :except => [:set]
7
+ attribute :name, except: [:set]
9
8
  attribute :title
10
- attribute :is_enabled, :name => :isEnabled
11
- attribute :edit_groups, :name => :editGroups, :type => :list
12
- attribute :mutiple_signatures, :name => :allowsMultipleSignatures
9
+ attribute :is_enabled, name: :isEnabled
10
+ attribute :edit_groups, name: :editGroups, type: :list
11
+ attribute :mutiple_signatures, name: :allowsMultipleSignatures
13
12
  # This attribute should be used as follows:
14
13
  # workflow.signatures = [{:attribute => 'mySigAttr', :group => 'myGroup'},{:attribute => 'mySigAttr', :group => 'myOtherGroup'}]
15
- attribute :signatures, :name => :signatureDefs, :type => :signaturelist
14
+ attribute :signatures, name: :signatureDefs, type: :signaturelist
16
15
 
17
16
  primary_key :name
18
17
 
19
18
  # Creates a workflow with given name. A list of edit groups
20
19
  # may also be specified - otherwise it defaults to empty list
21
20
  def self.create(name, edit_groups = [])
22
- super(name, {:name => name, :editGroups => edit_groups})
21
+ super(name, { name: name, editGroups: edit_groups })
23
22
  end
24
23
 
25
24
  def self.serialize_attribute_to_xml(xml, xml_attribute, value)
26
25
  if xml_attribute.name.to_sym == :signatureDefs
27
- xml.tag!('signatureDefs') do
26
+ xml.tag!("signatureDefs") do
28
27
  (value || []).each do |hash|
29
- xml.tag!('listitem') do
30
- xml.tag!('listitem', hash[:attribute])
31
- xml.tag!('listitem', hash[:group])
28
+ xml.tag!("listitem") do
29
+ xml.tag!("listitem", hash[:attribute])
30
+ xml.tag!("listitem", hash[:group])
32
31
  end
33
32
  end
34
33
  end
@@ -1,36 +1,27 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module Reactor
3
-
4
2
  module Cm
5
-
6
3
  class XmlAttribute
4
+ AVAILABLE_SCOPES = %i(get set create).freeze
7
5
 
8
- AVAILABLE_SCOPES = [:get, :set, :create]
9
-
10
- attr_accessor :name
11
- attr_accessor :type
12
- attr_accessor :scopes
6
+ attr_accessor :name, :type, :scopes
13
7
 
14
8
  def initialize(name, type, options)
15
9
  @name = name
16
10
  @type = type.presence || :string
17
11
 
18
12
  @scopes =
19
- if options[:except].present?
20
- AVAILABLE_SCOPES - options[:except]
21
- elsif options[:only].present?
22
- options[:only]
23
- else
24
- AVAILABLE_SCOPES
25
- end
13
+ if options[:except].present?
14
+ AVAILABLE_SCOPES - options[:except]
15
+ elsif options[:only].present?
16
+ options[:only]
17
+ else
18
+ AVAILABLE_SCOPES
19
+ end
26
20
  end
27
21
 
28
22
  def scope?(name)
29
- self.scopes.include?(name)
23
+ scopes.include?(name)
30
24
  end
31
-
32
25
  end
33
-
34
26
  end
35
-
36
27
  end
@@ -1,10 +1,8 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'builder'
1
+ require "builder"
3
2
 
4
3
  module Reactor
5
4
  module Cm
6
5
  class XmlMarkup < Builder::XmlMarkup
7
-
8
6
  def where_key_tag!(base_name, key, value)
9
7
  where_tag!(base_name) do |xml|
10
8
  xml.tag!(key.to_s) do
@@ -31,10 +29,10 @@ module Reactor
31
29
 
32
30
  def get_key_tag!(base_name, key)
33
31
  get_tag!(base_name) do |xml|
34
- if key.kind_of?(::Array)
35
- key.each {|k| xml.tag!(k.to_s) }
32
+ if key.is_a?(::Array)
33
+ key.each { |k| xml.tag!(k.to_s) }
36
34
  else
37
- xml.tag!(key.to_s) ; end
35
+ xml.tag!(key.to_s); end
38
36
  end
39
37
  end
40
38
 
@@ -57,8 +55,8 @@ module Reactor
57
55
  end
58
56
 
59
57
  def value_tag!(key, value, options = {})
60
- if value.kind_of? ::Array then array_value_tag!(key, value, options)
61
- elsif value.kind_of? ::Hash then hash_value_tag!(key, value)
58
+ if value.is_a? ::Array then array_value_tag!(key, value, options)
59
+ elsif value.is_a? ::Hash then hash_value_tag!(key, value)
62
60
  else tag!(key.to_s) { text!(value.to_s) }
63
61
  end
64
62
  end
@@ -66,7 +64,7 @@ module Reactor
66
64
  def array_value_tag!(name, values, options = {})
67
65
  tag!(name.to_s, options) do
68
66
  values.each do |value|
69
- tag!('listitem') do
67
+ tag!("listitem") do
70
68
  text!(value.to_s)
71
69
  end
72
70
  end
@@ -80,7 +78,6 @@ module Reactor
80
78
  end
81
79
  end
82
80
  end
83
-
84
81
  end
85
82
  end
86
83
  end
@@ -1,10 +1,8 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'reactor/cm/xml_request_error'
1
+ require "reactor/cm/xml_request_error"
3
2
 
4
3
  module Reactor
5
4
  module Cm
6
5
  class XmlMultiRequestError < XmlRequestError
7
-
8
6
  end
9
7
  end
10
8
  end
@@ -1,21 +1,14 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'net/http'
3
- require 'reactor/cm/xml_response'
4
- require 'reactor/cm/xml_single_request_error'
5
- require 'reactor/cm/xml_markup'
6
- require 'reactor/tools/smart_xml_logger'
1
+ require "net/http"
2
+ require "reactor/cm/xml_response"
3
+ require "reactor/cm/xml_single_request_error"
4
+ require "reactor/cm/xml_markup"
5
+ require "reactor/tools/smart_xml_logger"
7
6
 
8
7
  module Reactor
9
8
  module Cm
10
-
11
- if Rails.env.development? && false
12
- #LOGGER = SmartXmlLogger.new(Rails.logger, :debug)
13
- LOGGER = SmartXmlLogger.new(Kernel, :puts)
14
- else
15
- LOGGER = SmartXmlLogger.new(nil) # turn off logging
16
- end
17
- LOGGER.configure(:request, :xpath => 'cm-payload/cm-request/*', :start_indent => 2)
18
- LOGGER.configure(:response, :xpath => 'cm-payload/cm-response/*', :start_indent => 2)
9
+ LOGGER = SmartXmlLogger.new(nil) # turn off logging
10
+ LOGGER.configure(:request, xpath: "cm-payload/cm-request/*", start_indent: 2)
11
+ LOGGER.configure(:response, xpath: "cm-payload/cm-response/*", start_indent: 2)
19
12
 
20
13
  class XmlRequest
21
14
  cattr_accessor :timeout
@@ -26,18 +19,17 @@ module Reactor
26
19
  end
27
20
 
28
21
  def self.prepare
29
- access = Configuration::xml_access
22
+ access = Configuration.xml_access
30
23
  sanity_check(access)
31
24
  xml = XmlMarkup.new
32
- ret = nil
33
25
  xml.instruct!
34
- ret = xml.tag!('cm-payload', 'payload-id' =>'abcabc', 'timestamp' => Time.now.getutc.strftime('%Y%m%d%H%M%S'), 'version' => '6.7.3') do
35
- xml.tag!('cm-header') do
36
- xml.tag!('cm-sender', 'sender-id' => access[:id], 'name' => "ruby-simple-client")
37
- xml.tag!('cm-authentication', 'login' => access[:username], 'token' => token(access[:username],access[:secret]))
26
+ ret = xml.tag!("cm-payload", "payload-id" => "abcabc", "timestamp" => Time.now.getutc.strftime("%Y%m%d%H%M%S"), "version" => "6.7.3") do
27
+ xml.tag!("cm-header") do
28
+ xml.tag!("cm-sender", "sender-id" => access[:id], "name" => "ruby-simple-client")
29
+ xml.tag!("cm-authentication", "login" => access[:username], "token" => token(access[:username], access[:secret]))
38
30
  end
39
- id = self.generate_id
40
- xml.tag!('cm-request', 'request-id' => id) do |xml2|
31
+ id = generate_id
32
+ xml.tag!("cm-request", "request-id" => id) do |xml2|
41
33
  yield xml2 if block_given?
42
34
  end
43
35
  end
@@ -45,21 +37,22 @@ module Reactor
45
37
  end
46
38
 
47
39
  def execute!
48
- access = Configuration::xml_access
40
+ access = Configuration.xml_access
49
41
  payload = @xml
50
42
 
51
43
  res = Net::HTTP.new(access[:host], access[:port]).start do |http|
52
44
  http.read_timeout = self.class.timeout
53
- req = Net::HTTP::Post.new('/xml')
54
- Reactor::Cm::LOGGER.log('REQUEST:')
45
+ req = Net::HTTP::Post.new("/xml")
46
+ Reactor::Cm::LOGGER.log("REQUEST:")
55
47
  Reactor::Cm::LOGGER.log_xml(:request, payload)
56
48
  req.body = payload
57
49
  http.request(req)
58
50
  end
59
- Reactor::Cm::LOGGER.log('RESPONSE:')
51
+ Reactor::Cm::LOGGER.log("RESPONSE:")
60
52
  Reactor::Cm::LOGGER.log_xml(:response, res.body)
61
53
  response = XmlResponse.new(res.body)
62
54
  raise XmlSingleRequestError, response unless response.ok?
55
+
63
56
  response
64
57
  end
65
58
 
@@ -67,7 +60,7 @@ module Reactor
67
60
  protected
68
61
 
69
62
  def generate_id
70
- rand(10000)
63
+ rand(10_000)
71
64
  end
72
65
 
73
66
  def sanity_check(access)
@@ -80,7 +73,6 @@ module Reactor
80
73
  def initialize(xml)
81
74
  @xml = xml
82
75
  end
83
-
84
76
  end
85
77
  end
86
78
  end
@@ -1,11 +1,9 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module Reactor
3
2
  module Cm
4
3
  class XmlRequestError < StandardError
5
4
  def phrase
6
- self.message
5
+ message
7
6
  end
8
-
9
7
  end
10
8
  end
11
9
  end
@@ -1,16 +1,11 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'reactor/tools/response_handler/xml_attribute'
3
- require 'reactor/tools/xpath_extractor'
4
- require 'rexml/document'
1
+ require "reactor/tools/response_handler/xml_attribute"
2
+ require "reactor/tools/xpath_extractor"
3
+ require "rexml/document"
5
4
 
6
5
  module Reactor
7
-
8
6
  module Cm
9
-
10
7
  class XmlResponse
11
-
12
- attr_reader :xml
13
- attr_reader :xml_str
8
+ attr_reader :xml, :xml_str
14
9
 
15
10
  def initialize(xml)
16
11
  @xml_str = xml
@@ -24,19 +19,16 @@ module Reactor
24
19
  end
25
20
 
26
21
  def ok?
27
- xp = xpath('//cm-code')
22
+ xp = xpath("//cm-code")
28
23
 
29
24
  if xp.is_a?(Array)
30
- codes = xp.map { |result| result.attribute('numeric').value }.uniq
25
+ codes = xp.map { |result| result.attribute("numeric").value }.uniq
31
26
 
32
- return codes.size == 1 && codes.first == '200'
27
+ return codes.size == 1 && codes.first == "200"
33
28
  end
34
29
 
35
- xp.attribute('numeric').value == '200'
30
+ xp.attribute("numeric").value == "200"
36
31
  end
37
-
38
32
  end
39
-
40
33
  end
41
-
42
34
  end
@@ -1,5 +1,4 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'reactor/cm/xml_request_error'
1
+ require "reactor/cm/xml_request_error"
3
2
 
4
3
  module Reactor
5
4
  module Cm
@@ -10,12 +9,11 @@ module Reactor
10
9
  end
11
10
 
12
11
  def phrase
13
- result = @response.xpath('//phrase/text()')
14
- result = [result] unless result.kind_of?(Array)
12
+ result = @response.xpath("//phrase/text()")
13
+ result = [result] unless result.is_a?(Array)
15
14
 
16
15
  result.map(&:to_s).join("\n")
17
16
  end
18
-
19
17
  end
20
18
  end
21
19
  end
@@ -1,9 +1,7 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module Reactor
3
2
  class Configuration
4
3
  class << self
5
- attr_accessor :xml_access
6
- attr_accessor :sanitize_obj_name
4
+ attr_accessor :xml_access, :sanitize_obj_name
7
5
  end
8
6
 
9
7
  self.sanitize_obj_name = true
@@ -1,8 +1,4 @@
1
- require 'reactor/session_helper'
2
-
3
- # -*- encoding : utf-8 -*-
4
1
  module Reactor
5
-
6
2
  class Engine < Rails::Engine
7
3
  rake_tasks do
8
4
  load "tasks/cm_migrate.rake"
@@ -10,18 +6,17 @@ module Reactor
10
6
  end
11
7
 
12
8
  initializer "reactor.upgrade" do
13
- if Gem::Specification.find_all_by_name('infopark_reactor_migrations').any? || Gem::Specification.find_all_by_name('infopark_rails_connector_meta').any?
9
+ if Gem::Specification.find_all_by_name("infopark_reactor_migrations").any? || Gem::Specification.find_all_by_name("infopark_rails_connector_meta").any?
14
10
  raise "Please remove 'infopark_reactor_migrations' and 'infopark_rails_connector_meta' from your Gemfile. They are deprecated and no longer needed."
15
11
  end
16
12
  end
17
13
 
18
- initializer "reactor.rsession" do |app|
19
- ActionController::Base.__send__(:include, Reactor::SessionHelper::RsessionHelper)
14
+ initializer "reactor.rsession" do |_app|
15
+ ActionController::Base.include Reactor::SessionHelper::RsessionHelper
20
16
  ActionController::Base.__send__(:helper_method, :rsession)
21
17
 
22
- ActionController::Base.__send__(:include, Reactor::SessionHelper::AuthHelper)
18
+ ActionController::Base.include Reactor::SessionHelper::AuthHelper
19
+ ActionController::Base.include Reactor::SessionHelper::AuthFilter
23
20
  end
24
-
25
21
  end
26
-
27
22
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module Reactor
3
2
  # This is a collection of legacy method,s that have not found any better place to live.
4
3
  module Legacy
@@ -11,14 +10,14 @@ module Reactor
11
10
  # @option options :no_children if true prevents deletion unless there are no children
12
11
  # @option options :img_children_only if true prevents deletion unless there are exclusively img children
13
12
  # @option options [Array] :children if true prevents deletion if there are other children besides the specified ones (array of names)
14
- def delete_children!(options={})
13
+ def delete_children!(options = {})
15
14
  # TODO: provide better discrimination mechanisms (blocks?)
16
15
  f_nochild = options.delete(:no_children)
17
16
  f_imgchild = options.delete(:img_children_only)
18
17
  f_children = options.delete(:children)
19
18
 
20
- mychildren = self.children
21
- image_children, other_children = mychildren.partition {|obj| obj.obj_class == 'Image'}
19
+ mychildren = children
20
+ other_children = mychildren.reject { |obj| obj.obj_class == "Image" }
22
21
 
23
22
  # are there any links pointing to this container
24
23
  return false if has_super_links?
@@ -27,16 +26,16 @@ module Reactor
27
26
  # is the flag set and are there any children besides images
28
27
  return false if f_imgchild && !other_children.empty?
29
28
  # is the flag set and are there any children besides the specified ones
30
- return false if f_children && !((mychildren.map(&:name) - f_children).empty?)
29
+ return false if f_children && !(mychildren.map(&:name) - f_children).empty?
31
30
 
32
31
  # check children for any links pointing to them
33
32
  return false if mychildren.detect(&:has_super_links?)
34
33
  # check if there are any grandchildren
35
- return false if mychildren.detect {|child| !child.children.empty?}
34
+ return false if mychildren.detect { |child| !child.children.empty? }
36
35
 
37
36
  # delete children
38
37
  mychildren.each(&:destroy)
39
- return true
38
+ true
40
39
  end
41
40
  end
42
41
  module ClassMethods
@@ -1,15 +1,18 @@
1
- # -*- encoding : utf-8 -*-
2
1
  module Reactor
3
2
  module Link
4
3
  class External
5
4
  attr_accessor :url
6
5
 
7
- def external? ; true ; end
8
- def internal? ; false ; end
6
+ def external?
7
+ true
8
+ end
9
+
10
+ def internal?
11
+ false
12
+ end
9
13
 
10
- def initialize(url)
14
+ def initialize(_url)
11
15
  raise TypeError, "#{self.class.name} is deprecated!"
12
- self.url = url
13
16
  end
14
17
 
15
18
  def id