Sha256: 12a5d349d9bc2d80a813a8ad45e7723d7bc8652b011e46a1c62e99d0cec301c1
Contents?: true
Size: 1.82 KB
Versions: 10
Compression:
Stored size: 1.82 KB
Contents
# -*- encoding : utf-8 -*- class Card; module Set; class Abstract # Set: Abstract (FollowOption) # module FollowOption; extend Card::Set def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/follow/set/abstract/follow_option.rb"; end def restrictive_option? Card::FollowOption.restrictive_options.include? codename end def description set_card set_card.follow_label end # follow option methods on the Card class # FIXME: there's not a great reason to have these on the Card class module ClassMethods # args: # position: <Fixnum> (starting at 1, default: add to end) def restrictive_follow_opts args add_option args, :restrictive end # args: # position: <Fixnum> (starting at 1, default: add to end) def follow_opts args add_option args, :main end def follow_test opts={}, &block Card::FollowOption.test[get_codename(opts)] = block end def follower_candidate_ids opts={}, &block Card::FollowOption.follower_candidate_ids[get_codename(opts)] = block end private def insert_option pos, item, type list = Card::FollowOption.codenames(type) list[pos] ? list.insert(pos, item) : (list[pos] = item) # If pos > codenames.size in a previous insert then we have a bunch # of preceding nils in the array. # Hence, we have to overwrite a nil value if we encounter one and # can't use insert. end def add_option opts, type, &_block codename = get_codename opts if opts[:position] insert_option opts[:position] - 1, codename, type else Card::FollowOption.codenames(type) << codename end Card::FollowOption.codenames(:all) << codename end def get_codename opts opts[:codename] || name.match(/::(\w+)$/)[1].underscore.to_sym end end end;end;end;end; # ~~ generated from /Users/ethan/dev/decko/gem/card/mod/follow/set/abstract/follow_option.rb ~~
Version data entries
10 entries across 10 versions & 1 rubygems