Class: Card::Set::All::Notify::FollowerStash
- Inherits:
-
Object
- Object
- Card::Set::All::Notify::FollowerStash
- Defined in:
- tmpsets/set/mod012-email/all/notify.rb
Overview
~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/email/set/all/notify.rb ~~
Instance Method Summary collapse
- #add_affected_card(card) ⇒ Object
- #each_follower_with_reason ⇒ Object
- #followers ⇒ Object
-
#initialize(card = nil) ⇒ FollowerStash
constructor
A new instance of FollowerStash.
Constructor Details
#initialize(card = nil) ⇒ FollowerStash
Returns a new instance of FollowerStash.
6 7 8 9 10 |
# File 'tmpsets/set/mod012-email/all/notify.rb', line 6 def initialize card=nil @followed_affected_cards = Hash.new { |h, v| h[v] = [] } @visited = ::Set.new add_affected_card(card) if card end |
Instance Method Details
#add_affected_card(card) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'tmpsets/set/mod012-email/all/notify.rb', line 12 def add_affected_card card return if @visited.include? card.key Auth.as_bot do @visited.add card.key notify_direct_followers card return if !(left_card = card.left) || @visited.include?(left_card.key) || !(follow_field_rule = left_card.rule_card(:follow_fields)) follow_field_rule.item_names(context: left_card.cardname).each do |item| if @visited.include? item.to_name.key add_affected_card left_card break elsif item.to_name.key == Card[:includes].key includee_set = Card.search( { included_by: left_card.name }, "follow cards included by #{left_card.name}" ).map(&:key) unless @visited.intersection(includee_set).empty? add_affected_card left_card break end end end end end |
#each_follower_with_reason ⇒ Object
41 42 43 44 45 46 |
# File 'tmpsets/set/mod012-email/all/notify.rb', line 41 def each_follower_with_reason # "follower"(=user) is a card object, "followed"(=reasons) a card name @followed_affected_cards.each do |user, reasons| yield(user, reasons.first) end end |
#followers ⇒ Object
37 38 39 |
# File 'tmpsets/set/mod012-email/all/notify.rb', line 37 def followers @followed_affected_cards.keys end |