Module: Card::Set::All::Account
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod025-account/all/account.rb
Overview
Defined Under Namespace
Modules: ClassMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from I18nScope
#mod_name, #scope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#abstract_set?, #all_set?, #num_set_parts, #shortname, #underscore
#attachment, #ensure_set, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket, #unshift_basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
#event
Class Method Details
.source_location ⇒ Object
7
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 7
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/account/set/all/account.rb"; end
|
Instance Method Details
#account ⇒ Object
14
15
16
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 14
def account
fetch trait: :account
end
|
#accountable? ⇒ Boolean
18
19
20
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 18
def accountable?
Card.toggle(rule(:accountable))
end
|
#all_roles ⇒ Object
54
55
56
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 54
def all_roles
@all_roles ||= (id == Card::AnonymousID ? [] : fetch_roles)
end
|
#among?(ok_ids) ⇒ Boolean
26
27
28
29
30
31
32
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 26
def among? ok_ids
ok_ids.any? do |ok_id|
ok_id == Card::AnyoneID ||
(ok_id == Card::AnyoneWithRoleID && all_roles.size > 1) ||
parties.member?(ok_id)
end
end
|
#fetch_roles ⇒ Object
58
59
60
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 58
def fetch_roles
[Card::AnyoneSignedInID] + role_ids_from_roles_trait
end
|
#own_account? ⇒ Boolean
34
35
36
37
38
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 34
def own_account?
name.part_names[0].key == Auth.as_card.key &&
name.part_names[1].key == Card[:account].key
end
|
#parties ⇒ Object
22
23
24
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 22
def parties
@parties ||= (all_roles << id).flatten.reject(&:blank?)
end
|
#read_rules ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 40
def read_rules
@read_rules ||= begin
rule_ids = []
unless id == Card::WagnBotID
([Card::AnyoneID] + parties).each do |party_id|
if (rule_ids_for_party = self.class.read_rule_cache[party_id])
rule_ids += rule_ids_for_party
end
end
end
rule_ids
end
end
|
#role_ids_from_roles_trait ⇒ Object
62
63
64
65
66
67
|
# File 'tmpsets/set/mod025-account/all/account.rb', line 62
def role_ids_from_roles_trait
Auth.as_bot do
role_trait = fetch trait: :roles
role_trait ? role_trait.item_ids : []
end
end
|