card 1.108.1 → 1.109.1
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 +4 -4
- data/VERSION +1 -1
- data/config/environments/development.rb +1 -1
- data/config/environments/production.rb +5 -2
- data/config/initializers/01_core_extensions/array.rb +1 -0
- data/config/initializers/01_core_extensions/hash.rb +4 -0
- data/config/initializers/02_patches/active_record.rb +1 -1
- data/config/initializers/core_extensions.rb +0 -1
- data/config/initializers/deck_config.rb +3 -3
- data/config/initializers/patches.rb +6 -6
- data/config/locales/es.yml +2 -3
- data/db/seeds.rb +0 -1
- data/lib/card/auth/current.rb +8 -6
- data/lib/card/auth/permissions.rb +1 -1
- data/lib/card/auth/proxy.rb +2 -2
- data/lib/card/auth/setup.rb +2 -2
- data/lib/card/auth.rb +7 -6
- data/lib/card/cache/all.rb +1 -1
- data/lib/card/cache/class_methods.rb +2 -4
- data/lib/card/cache/shared.rb +1 -1
- data/lib/card/cache/temporary.rb +2 -2
- data/lib/card/codename.rb +1 -1
- data/lib/card/content/chunk/abstract.rb +1 -0
- data/lib/card/content/chunk.rb +0 -1
- data/lib/card/content/clean.rb +4 -2
- data/lib/card/content/diff/l_c_s.rb +1 -2
- data/lib/card/content/diff/result.rb +2 -1
- data/lib/card/content/diff.rb +2 -1
- data/lib/card/content/parser.rb +8 -7
- data/lib/card/content.rb +1 -1
- data/lib/card/director/subdirector_array.rb +1 -0
- data/lib/card/director.rb +1 -1
- data/lib/card/dirty/method_factory.rb +1 -0
- data/lib/card/env/location.rb +3 -3
- data/lib/card/env/location_history.rb +20 -20
- data/lib/card/env/success/target.rb +4 -4
- data/lib/card/env/support.rb +25 -2
- data/lib/card/error.rb +1 -0
- data/lib/card/fetch/store.rb +1 -1
- data/lib/card/format/error.rb +13 -2
- data/lib/card/format/method_delegation.rb +6 -4
- data/lib/card/format/registration.rb +5 -3
- data/lib/card/format/render.rb +51 -47
- data/lib/card/format/wrapper.rb +1 -0
- data/lib/card/lexicon.rb +5 -2
- data/lib/card/mailer.rb +1 -14
- data/lib/card/name/all/parts.rb +1 -1
- data/lib/card/name/all.rb +5 -0
- data/lib/card/name/name_variants.rb +1 -0
- data/lib/card/query/abstract_query/query_helper.rb +1 -2
- data/lib/card/query/abstract_query/tie.rb +1 -1
- data/lib/card/query/abstract_query.rb +3 -3
- data/lib/card/query/card_class.rb +1 -0
- data/lib/card/query/card_query/relational_attributes.rb +1 -1
- data/lib/card/query/card_query/run.rb +5 -1
- data/lib/card/query/clause.rb +1 -0
- data/lib/card/query/join.rb +3 -3
- data/lib/card/query/sql_statement.rb +7 -1
- data/lib/card/query.rb +1 -1
- data/lib/card/reference/all.rb +6 -7
- data/lib/card/rule/cache.rb +1 -0
- data/lib/card/rule/preference_cache.rb +2 -0
- data/lib/card/rule/read_rule_cache.rb +3 -0
- data/lib/card/set/event/all.rb +6 -4
- data/lib/card/set/event/callbacks.rb +1 -0
- data/lib/card/set/event/options.rb +3 -2
- data/lib/card/set/event/skip_and_trigger.rb +1 -1
- data/lib/card/set/event.rb +2 -2
- data/lib/card/set/format/abstract_format/view_definition.rb +1 -1
- data/lib/card/set/format/haml_paths.rb +1 -1
- data/lib/card/set/format.rb +4 -4
- data/lib/card/set/helpers.rb +4 -4
- data/lib/card/set/i18n_scanner.rb +23 -22
- data/lib/card/set/i18n_scope.rb +4 -3
- data/lib/card/set/pattern/all.rb +1 -1
- data/lib/card/set/pattern/base.rb +6 -3
- data/lib/card/set/pattern/class_methods.rb +1 -1
- data/lib/card/set/pattern.rb +1 -1
- data/lib/card/set/required_field.rb +3 -0
- data/lib/card/set/trait.rb +6 -1
- data/lib/card/subcards/all.rb +12 -4
- data/lib/card/view/cache/cache_action.rb +9 -3
- data/lib/card/view/cache.rb +17 -15
- data/lib/card/view/classy.rb +5 -5
- data/lib/card/view/options/key_lists.rb +1 -0
- data/lib/card/view/options/voo_api.rb +2 -2
- data/lib/card/view/options.rb +1 -0
- data/lib/card/view.rb +1 -1
- data/lib/cardio/command/application.rb +1 -1
- data/lib/cardio/command/custom.rb +7 -6
- data/lib/cardio/command/rake_command.rb +3 -2
- data/lib/cardio/command/rspec_command.rb +1 -0
- data/lib/cardio/generators/deck_generator_loader.rb +1 -1
- data/lib/cardio/generators.rb +4 -3
- data/lib/cardio/migration/port.rb +2 -0
- data/lib/cardio/migration/stamp.rb +1 -0
- data/lib/cardio/migration/transform.rb +1 -0
- data/lib/cardio/migration.rb +2 -0
- data/lib/cardio/mod/class_methods.rb +1 -2
- data/lib/cardio/mod/dirs.rb +2 -4
- data/lib/cardio/mod/eat/edibles.rb +8 -6
- data/lib/cardio/mod/eat.rb +7 -9
- data/lib/cardio/mod/load_strategy/set_binding_magic.rb +1 -1
- data/lib/cardio/mod/load_strategy/tmp_files.rb +3 -2
- data/lib/cardio/mod/load_strategy.rb +1 -0
- data/lib/cardio/mod/loader/set_pattern_loader.rb +4 -0
- data/lib/cardio/mod/loader/set_template.rb +14 -4
- data/lib/cardio/mod/loader.rb +2 -2
- data/lib/cardio/mod/sow/card_source.rb +1 -1
- data/lib/cardio/mod/sow/remote_source.rb +32 -0
- data/lib/cardio/mod/sow.rb +10 -10
- data/lib/cardio/railtie.rb +1 -0
- data/lib/cardio/script_loader.rb +1 -1
- data/lib/cardio/seed.rb +2 -2
- data/lib/cardio/utils.rb +1 -1
- data/lib/cardio/version.rb +2 -1
- data/lib/cardio.rb +3 -0
- data/lib/generators/deck/templates/config.ru.erb +1 -1
- data/mod/core/config/locales/de.yml +1 -1
- data/mod/core/config/locales/en.yml +2 -1
- data/mod/core/data/fixtures/real/cards.yml +1 -1
- data/mod/core/data/real.yml +1 -1
- data/mod/core/data/recode.yml +1 -0
- data/mod/core/data/schema/20141001105348_move_revisions_to_actions.rb +2 -2
- data/mod/core/data/schema/20241017160402_unique_codename.rb +8 -0
- data/mod/core/data/transform/20150724123438_update_file_and_image_cards.rb +1 -1
- data/mod/core/lib/tasks/card/export.rake +28 -0
- data/mod/core/lib/tasks/card/migrate.rake +3 -3
- data/mod/core/lib/tasks/card/mod.rake +1 -1
- data/mod/core/lib/tasks/card/seed.rake +2 -1
- data/mod/core/lib/tasks/card.rake +48 -16
- data/mod/core/set/all/admin.rb +1 -2
- data/mod/core/set/all/assign_attributes.rb +3 -2
- data/mod/core/set/all/codename.rb +7 -1
- data/mod/core/set/all/debug.rb +3 -3
- data/mod/core/set/all/initialize.rb +1 -0
- data/mod/core/set/all/states.rb +13 -16
- data/mod/core/set/all/type.rb +3 -1
- data/mod/core/set/all/utils.rb +0 -1
- data/mod/core/set/self/admin.rb +2 -1
- data/mod/core/set/self/autoname.rb +1 -1
- data/mod/core/set/self/mod.rb +4 -4
- data/mod/core/set/self/trash.rb +1 -1
- data/mod/core/set/type/mod.rb +18 -15
- data/mod/core/set_pattern/09_self.rb +4 -0
- data/mod/core/spec/set/all/admin_spec.rb +1 -1
- data/mod/core/spec/set/all/trash_spec.rb +9 -9
- metadata +42 -29
data/lib/card/env/support.rb
CHANGED
@@ -21,10 +21,33 @@ class Card
|
|
21
21
|
def reset_session
|
22
22
|
if session.is_a? Hash
|
23
23
|
@session = {}
|
24
|
-
|
25
|
-
|
24
|
+
elsif request
|
25
|
+
update_session_options drop: false
|
26
|
+
controller.reset_session
|
27
|
+
# destroy_cookie unless Cardio.config.allow_anonymous_cookies
|
26
28
|
end
|
27
29
|
end
|
30
|
+
|
31
|
+
def update_session_options drop: nil
|
32
|
+
return unless request
|
33
|
+
return if Cardio.config.allow_anonymous_cookies
|
34
|
+
|
35
|
+
request.session_options[:drop] = drop.nil? ? !Auth.signed_in? : drop
|
36
|
+
end
|
37
|
+
|
38
|
+
# private
|
39
|
+
|
40
|
+
# FIXME: not working
|
41
|
+
# the response generally works to destroy a cookie, but
|
42
|
+
# the deletion doesn't appear to work in a redirect. Since signing out
|
43
|
+
# has a redirect response, we're still left with a cookie
|
44
|
+
# def destroy_cookie
|
45
|
+
# app = Cardio.application
|
46
|
+
# app_name = app.class.name ? app.railtie_name.chomp("_application") : ""
|
47
|
+
# expire_in_past = "expires=Thu, 01 Jan 1970 00:00:00 GMT;"
|
48
|
+
# controller.response.set_header "SET-COOKIE",
|
49
|
+
# "_#{app_name}_session=deleted; #{expire_in_past}"
|
50
|
+
# end
|
28
51
|
end
|
29
52
|
end
|
30
53
|
end
|
data/lib/card/error.rb
CHANGED
data/lib/card/fetch/store.rb
CHANGED
data/lib/card/format/error.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Card
|
2
2
|
class Format
|
3
|
+
# permissions and errors in card format classes
|
3
4
|
module Error
|
4
5
|
def ok? task
|
5
6
|
task = :create if task == :update && card.new_card?
|
@@ -16,8 +17,8 @@ class Card
|
|
16
17
|
|
17
18
|
def view_for_unknown setting_view
|
18
19
|
if main? && voo.root?
|
19
|
-
root.error_status =
|
20
|
-
|
20
|
+
root.error_status = page_status_for_unknown
|
21
|
+
page_view_for_unknown
|
21
22
|
else
|
22
23
|
setting_view || :unknown
|
23
24
|
end
|
@@ -38,11 +39,21 @@ class Card
|
|
38
39
|
yield
|
39
40
|
end
|
40
41
|
|
42
|
+
private
|
43
|
+
|
41
44
|
def rescue_view e, view
|
42
45
|
method = loud_error? ? :loud_error : :quiet_error
|
43
46
|
send method, e, view
|
44
47
|
end
|
45
48
|
|
49
|
+
def page_status_for_unknown
|
50
|
+
404
|
51
|
+
end
|
52
|
+
|
53
|
+
def page_view_for_unknown
|
54
|
+
:not_found
|
55
|
+
end
|
56
|
+
|
46
57
|
def error_cardname _exception
|
47
58
|
if card&.name.present?
|
48
59
|
safe_name
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class Card
|
2
2
|
class Format
|
3
|
+
# missing methods may be render calls or action view methods
|
4
|
+
# these methods sort that out
|
3
5
|
module MethodDelegation
|
4
6
|
RENDER_METHOD_RE =
|
5
7
|
/^
|
@@ -40,7 +42,7 @@ class Card
|
|
40
42
|
if (match = api_render? method)
|
41
43
|
api_render match, opts
|
42
44
|
else
|
43
|
-
delegate_to_action_view
|
45
|
+
delegate_to_action_view method, opts, &proc
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
@@ -66,9 +68,9 @@ class Card
|
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
69
|
-
def delegate_to_action_view method, opts,
|
70
|
-
|
71
|
-
response = action_view.send method, *opts, &
|
71
|
+
def delegate_to_action_view method, opts, &old_proc
|
72
|
+
new_proc = proc { |*a| raw yield(*a) } if old_proc
|
73
|
+
response = action_view.send method, *opts, &new_proc
|
72
74
|
response.is_a?(String) ? action_view.raw(response) : response
|
73
75
|
end
|
74
76
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class Card
|
2
2
|
class Format
|
3
|
+
# handles format registry, tracking which formats (html, css, json, etc) are
|
4
|
+
# available
|
3
5
|
module Registration
|
4
6
|
def register format
|
5
7
|
registered << format.to_s
|
@@ -7,11 +9,11 @@ class Card
|
|
7
9
|
end
|
8
10
|
|
9
11
|
def new card, opts={}
|
10
|
-
if self
|
11
|
-
super
|
12
|
-
else
|
12
|
+
if self == Format
|
13
13
|
klass = format_class opts
|
14
14
|
self == klass ? super : klass.new(card, opts)
|
15
|
+
else
|
16
|
+
super
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
data/lib/card/format/render.rb
CHANGED
@@ -41,6 +41,57 @@ class Card
|
|
41
41
|
add_debug_info view, method, rendered
|
42
42
|
end
|
43
43
|
|
44
|
+
def pretty_path source_location
|
45
|
+
"#{source_location.first.gsub(%r{^.+mod\d+-([^/]+)},
|
46
|
+
'\1: ')}:#{source_location.second}"
|
47
|
+
end
|
48
|
+
|
49
|
+
# see {Abstract::Format}
|
50
|
+
# (:default), :yes, :deep, :always, :never
|
51
|
+
def view_cache_setting view
|
52
|
+
voo&.cache || view_setting(:cache, view) || :default
|
53
|
+
end
|
54
|
+
|
55
|
+
def view_setting setting_name, view
|
56
|
+
try Card::Set::Format.view_setting_method_name(view, setting_name)
|
57
|
+
end
|
58
|
+
|
59
|
+
def stub_render cached_content
|
60
|
+
return cached_content if Cardio.config.view_cache == :debug
|
61
|
+
|
62
|
+
# stub_debugging do
|
63
|
+
expand_stubs cached_content
|
64
|
+
# end
|
65
|
+
end
|
66
|
+
|
67
|
+
def view_method view
|
68
|
+
unless supports_view? view
|
69
|
+
raise Card::Error::UserError, unsupported_view_error_message(view)
|
70
|
+
end
|
71
|
+
|
72
|
+
method Card::Set::Format.view_method_name(view)
|
73
|
+
end
|
74
|
+
|
75
|
+
def supports_view? view
|
76
|
+
respond_to? Card::Set::Format.view_method_name(view)
|
77
|
+
end
|
78
|
+
|
79
|
+
def current_view view
|
80
|
+
old_view = @current_view
|
81
|
+
@current_view = view
|
82
|
+
yield
|
83
|
+
ensure
|
84
|
+
@current_view = old_view
|
85
|
+
end
|
86
|
+
|
87
|
+
def stub_nest stub_hash
|
88
|
+
prepare_stub_nest(stub_hash) do |stub_card, view_opts|
|
89
|
+
nest stub_card, view_opts, stub_hash[:format_opts]
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
44
95
|
def wrap_and_render view
|
45
96
|
current_view(view) { with_wrapper { final_render view } }
|
46
97
|
rescue StandardError => e
|
@@ -64,27 +115,6 @@ class Card
|
|
64
115
|
Env.params[:debug] == "view"
|
65
116
|
end
|
66
117
|
|
67
|
-
def pretty_path source_location
|
68
|
-
"#{source_location.first.gsub(%r{^.+mod\d+-([^/]+)},
|
69
|
-
'\1: ')}:#{source_location.second}"
|
70
|
-
end
|
71
|
-
|
72
|
-
# see {Abstract::Format}
|
73
|
-
# (:default), :yes, :deep, :always, :never
|
74
|
-
def view_cache_setting view
|
75
|
-
voo&.cache || view_setting(:cache, view) || :default
|
76
|
-
end
|
77
|
-
|
78
|
-
def view_setting setting_name, view
|
79
|
-
try Card::Set::Format.view_setting_method_name(view, setting_name)
|
80
|
-
end
|
81
|
-
|
82
|
-
def stub_render cached_content
|
83
|
-
# stub_debugging do
|
84
|
-
expand_stubs cached_content
|
85
|
-
# end
|
86
|
-
end
|
87
|
-
|
88
118
|
# def stub_debugging
|
89
119
|
# result = yield
|
90
120
|
# if Rails.env.development? && result.is_a?(String) && result =~ /StUb/
|
@@ -118,32 +148,6 @@ class Card
|
|
118
148
|
conto.to_s
|
119
149
|
end
|
120
150
|
end
|
121
|
-
|
122
|
-
def view_method view
|
123
|
-
unless supports_view? view
|
124
|
-
raise Card::Error::UserError, unsupported_view_error_message(view)
|
125
|
-
end
|
126
|
-
|
127
|
-
method Card::Set::Format.view_method_name(view)
|
128
|
-
end
|
129
|
-
|
130
|
-
def supports_view? view
|
131
|
-
respond_to? Card::Set::Format.view_method_name(view)
|
132
|
-
end
|
133
|
-
|
134
|
-
def current_view view
|
135
|
-
old_view = @current_view
|
136
|
-
@current_view = view
|
137
|
-
yield
|
138
|
-
ensure
|
139
|
-
@current_view = old_view
|
140
|
-
end
|
141
|
-
|
142
|
-
def stub_nest stub_hash
|
143
|
-
prepare_stub_nest(stub_hash) do |stub_card, view_opts|
|
144
|
-
nest stub_card, view_opts, stub_hash[:format_opts]
|
145
|
-
end
|
146
|
-
end
|
147
151
|
end
|
148
152
|
end
|
149
153
|
end
|
data/lib/card/format/wrapper.rb
CHANGED
data/lib/card/lexicon.rb
CHANGED
@@ -18,9 +18,12 @@ class Card
|
|
18
18
|
# param name [String]
|
19
19
|
# @return [Integer]
|
20
20
|
def id name
|
21
|
-
return
|
21
|
+
return if name.blank?
|
22
22
|
|
23
|
-
|
23
|
+
name = name.to_name
|
24
|
+
return if name.relative_fragment?
|
25
|
+
|
26
|
+
(lex = name_to_lex name) && lex_to_id(lex)
|
24
27
|
end
|
25
28
|
|
26
29
|
def cache
|
data/lib/card/mailer.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "open-uri"
|
4
4
|
|
5
5
|
class Card
|
6
|
+
# extends ActionMailer with card config
|
6
7
|
class Mailer < ActionMailer::Base
|
7
8
|
class << self
|
8
9
|
def new_mail *args, &block
|
@@ -14,20 +15,6 @@ class Card
|
|
14
15
|
end
|
15
16
|
end
|
16
17
|
|
17
|
-
def layout message
|
18
|
-
<<-HTML
|
19
|
-
<!DOCTYPE html>
|
20
|
-
<html>
|
21
|
-
<head>
|
22
|
-
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
|
23
|
-
</head>
|
24
|
-
<body>
|
25
|
-
#{message}
|
26
|
-
</body>
|
27
|
-
</html>
|
28
|
-
HTML
|
29
|
-
end
|
30
|
-
|
31
18
|
def defaults_from_config
|
32
19
|
(Card.config.email_defaults || {}).symbolize_keys.tap do |defaults|
|
33
20
|
defaults[:return_path] ||= defaults[:from] if defaults[:from]
|
data/lib/card/name/all/parts.rb
CHANGED
@@ -5,7 +5,7 @@ class Card
|
|
5
5
|
module Parts
|
6
6
|
def left *args
|
7
7
|
case
|
8
|
-
when simple?
|
8
|
+
when simple? then nil
|
9
9
|
when superleft then superleft
|
10
10
|
when name_is_changing? && name.to_name.trunk_name == name_before_act.to_name
|
11
11
|
nil # prevent recursion when, eg, renaming A+B to A+B+C
|
data/lib/card/name/all.rb
CHANGED
@@ -8,6 +8,7 @@ class Card
|
|
8
8
|
# TODO: use delegations and include more name functions
|
9
9
|
delegate :simple?, :compound?, :junction?, to: :name
|
10
10
|
attr_reader :supercard
|
11
|
+
|
11
12
|
def name
|
12
13
|
@name ||= left_id ? Lexicon.lex_to_name([left_id, right_id]) : super.to_name
|
13
14
|
end
|
@@ -57,6 +58,10 @@ class Card
|
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
61
|
+
def id_string
|
62
|
+
"~#{id}"
|
63
|
+
end
|
64
|
+
|
60
65
|
def key= newkey
|
61
66
|
return if newkey == key
|
62
67
|
|
@@ -4,7 +4,7 @@ class Card
|
|
4
4
|
# interpret CQL attributes that relate multiple cards
|
5
5
|
# each method below corresponds to a relational CQL term
|
6
6
|
#
|
7
|
-
# NOTE: methods using "restrict" can
|
7
|
+
# NOTE: methods using "restrict" can be executed without
|
8
8
|
# tying in an additional query if the val in question can be
|
9
9
|
# reduced to an id.
|
10
10
|
module RelationalAttributes
|
@@ -38,7 +38,7 @@ class Card
|
|
38
38
|
case
|
39
39
|
when respond_to?(:"#{retrn}_result") then :"#{retrn}_result"
|
40
40
|
when retrn.match?(/id$/) then :id_result
|
41
|
-
when retrn.match?(
|
41
|
+
when retrn.match?(/^_\w+/) then :name_result
|
42
42
|
when retrn == "key" then :key_result
|
43
43
|
else :default_result
|
44
44
|
end
|
@@ -52,6 +52,10 @@ class Card
|
|
52
52
|
record[field]
|
53
53
|
end
|
54
54
|
|
55
|
+
def content_result record, _pattern
|
56
|
+
record["db_content"]
|
57
|
+
end
|
58
|
+
|
55
59
|
def id_result record, field
|
56
60
|
record[field].to_i
|
57
61
|
end
|
data/lib/card/query/clause.rb
CHANGED
data/lib/card/query/join.rb
CHANGED
@@ -24,6 +24,7 @@ class Card
|
|
24
24
|
@fields = fields
|
25
25
|
@tables = tables
|
26
26
|
@joins = joins
|
27
|
+
@indexes = indexes
|
27
28
|
@where = where
|
28
29
|
@group = group
|
29
30
|
@order = order
|
@@ -33,7 +34,8 @@ class Card
|
|
33
34
|
|
34
35
|
def to_s
|
35
36
|
[
|
36
|
-
comment, select, from,
|
37
|
+
comment, select, from,
|
38
|
+
@joins, @indexes, @where, @group, @order, @limit_and_offset
|
37
39
|
].compact.join " "
|
38
40
|
end
|
39
41
|
|
@@ -103,6 +105,10 @@ class Card
|
|
103
105
|
end
|
104
106
|
end
|
105
107
|
|
108
|
+
def indexes
|
109
|
+
"USE INDEX (#{Array.wrap(@mods[:index]).join ', '})" if @mods[:index]
|
110
|
+
end
|
111
|
+
|
106
112
|
def full_syntax
|
107
113
|
@query.full? ? yield : return
|
108
114
|
end
|
data/lib/card/query.rb
CHANGED
@@ -83,7 +83,7 @@ class Card
|
|
83
83
|
# "dir" is DEPRECATED in favor of sort_dir
|
84
84
|
# "sort" is DEPRECATED in favor of sort_by, except in cases where sort's value
|
85
85
|
# is a hash
|
86
|
-
MODIFIERS = %i[conj return sort_by sort_as sort_dir sort dir group limit offset]
|
86
|
+
MODIFIERS = %i[conj return index sort_by sort_as sort_dir sort dir group limit offset]
|
87
87
|
.each_with_object({}) { |v, h| h[v] = nil }
|
88
88
|
|
89
89
|
OPERATORS =
|
data/lib/card/reference/all.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
class Card
|
2
2
|
class Reference < Cardio::Record
|
3
|
-
|
4
|
-
# frozen_string_literal: true
|
5
|
-
|
6
|
-
# Cards can refer to other cards in their content, eg via links and nests.
|
7
|
-
# The card that refers is the "referer", the card that is referred to is
|
8
|
-
# the "referee". The reference itself has its own class (Card::Reference),
|
9
|
-
# which handles id-based reference tracking.
|
3
|
+
# frozen_string_literal: true
|
10
4
|
|
5
|
+
# Cards can refer to other cards in their content, eg via links and nests.
|
6
|
+
# The card that refers is the "referer", the card that is referred to is
|
7
|
+
# the "referee". The reference itself has its own class (Card::Reference),
|
8
|
+
# which handles id-based reference tracking.
|
9
|
+
module All
|
11
10
|
PARTIAL_REF_CODE = "P".freeze
|
12
11
|
|
13
12
|
# cards that refer to self
|
data/lib/card/rule/cache.rb
CHANGED
data/lib/card/set/event/all.rb
CHANGED
@@ -14,7 +14,9 @@ class Card
|
|
14
14
|
include SkipAndTrigger
|
15
15
|
|
16
16
|
def event_applies? event
|
17
|
-
|
17
|
+
unless set_condition_applies? event.set_module, event.opts[:changing]
|
18
|
+
return false
|
19
|
+
end
|
18
20
|
|
19
21
|
CONDITIONS.all? { |c| send "#{c}_condition_applies?", event, event.opts[c] }
|
20
22
|
end
|
@@ -91,10 +93,10 @@ class Card
|
|
91
93
|
def wrong_stage opts
|
92
94
|
return false if director.stage_ok? opts
|
93
95
|
|
94
|
-
if
|
95
|
-
"phase method #{method} called outside of event phases"
|
96
|
-
else
|
96
|
+
if stage
|
97
97
|
"#{opts.inspect} method #{method} called in stage #{stage}"
|
98
|
+
else
|
99
|
+
"phase method #{method} called outside of event phases"
|
98
100
|
end
|
99
101
|
end
|
100
102
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Card
|
2
2
|
module Set
|
3
3
|
class Event
|
4
|
+
# handle options available for event definition
|
4
5
|
module Options
|
5
6
|
def validate_conditions
|
6
7
|
@opts.each do |key, val|
|
@@ -32,8 +33,8 @@ class Card
|
|
32
33
|
return if invalid.empty?
|
33
34
|
|
34
35
|
raise ArgumentError,
|
35
|
-
"invalid option#{'s' if invalid.size > 1} '#{invalid}' "\
|
36
|
-
|
36
|
+
"invalid option#{'s' if invalid.size > 1} '#{invalid}' " \
|
37
|
+
"for condition '#{condition}' in event '#{@event}'"
|
37
38
|
end
|
38
39
|
|
39
40
|
def invalid_condition_values condition, val
|
@@ -7,7 +7,7 @@ class Card
|
|
7
7
|
:skip, # [Array] skip event(s) for all cards in act
|
8
8
|
:skip_in_action, # [Array] skip event for just this card
|
9
9
|
:trigger, # [Array] trigger event(s) for all cards in act
|
10
|
-
:trigger_in_action
|
10
|
+
:trigger_in_action # [Array] trigger event for just this card
|
11
11
|
]
|
12
12
|
attr_reader(*settings)
|
13
13
|
|
data/lib/card/set/event.rb
CHANGED
@@ -165,8 +165,8 @@ class Card
|
|
165
165
|
end
|
166
166
|
|
167
167
|
# one failed integration event should not harm others.
|
168
|
-
def rescuing_integration
|
169
|
-
Error.rescue_card(self)
|
168
|
+
def rescuing_integration &block
|
169
|
+
Error.rescue_card(self, &block)
|
170
170
|
ensure
|
171
171
|
true
|
172
172
|
end
|
data/lib/card/set/format.rb
CHANGED
@@ -103,14 +103,14 @@ class Card
|
|
103
103
|
|
104
104
|
# shortcut for {AbstractFormat#view} for when #view is called outside of a format
|
105
105
|
# block
|
106
|
-
def view
|
107
|
-
format { view(
|
106
|
+
def view(...)
|
107
|
+
format { view(...) }
|
108
108
|
end
|
109
109
|
|
110
110
|
# shortcut for {AbstractFormat#before} for when #before is called outside of a
|
111
111
|
# format block
|
112
|
-
def before
|
113
|
-
format { before
|
112
|
+
def before(...)
|
113
|
+
format { before(...) }
|
114
114
|
end
|
115
115
|
|
116
116
|
private
|