Sha256: 4711c0134e6b1cf3cf27b788aed1c6e37f2f6907288ff708ddd4ca599e810f9f

Contents?: true

Size: 2 KB

Versions: 9

Compression:

Stored size: 2 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class Type
# Set: All "Set" cards
#
module Set;
extend Card::Set
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/rules/set/type/set.rb"; end
include_set Type::SearchType

def inheritable?
  return true if junction_only?

  name.trunk_name.junction? &&
    name.tag_name.key == Card::Set::Self.pattern.key
end

def subclass_for_set
  current_set_pattern_code = tag.codename
  Card.set_patterns.find do |set|
    current_set_pattern_code == set.pattern_code
  end
end

def junction_only?
  if @junction_only.nil?
    @junction_only = subclass_for_set.junction_only
  else
    @junction_only
  end
end

def label
  if (klass = subclass_for_set)
    klass.label name.left
  else
    ""
  end
end

def uncapitalized_label
  label = label.to_s
  return label unless label[0]

  label[0] = label[0].downcase
  label
end

def all_user_ids_with_rule_for setting_code
  Card.all_user_ids_with_rule_for self, setting_code
end

def setting_codenames_by_group
  result = {}
  Card::Setting.groups.each do |group, settings|
    visible_settings =
      settings.reject { |s| !s || !s.applies_to_cardtype(prototype.type_id) }
    result[group] = visible_settings.map(&:codename) unless visible_settings.empty?
  end
  result
end

def visible_setting_codenames
  @visible_setting_codenames ||= visible_settings.map(&:codename)
end

def visible_settings group=nil
  settings =
    (group && Card::Setting.groups[group]) || Card::Setting.groups.values.flatten.compact
  settings.reject do |setting|
    !setting || !setting.applies_to_cardtype(prototype.type_id)
  end
end

def broader_sets
  prototype.set_names[1..-1]
end

def prototype
  opts = subclass_for_set.prototype_args name.trunk_name
  Card.fetch opts[:name], new: opts
end

def related_sets with_self=false
  if subclass_for_set.anchorless?
    prototype.related_sets with_self
  else
    left(new: {}).related_sets with_self
  end
end
end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card/mod/rules/set/type/set.rb ~~

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
card-1.99.4 tmpsets/set/mod022-rules/type/set.rb
card-1.99.3 tmpsets/set/mod022-rules/type/set.rb
card-1.99.2 tmpsets/set/mod022-rules/type/set.rb
card-1.99.1 tmpsets/set/mod022-rules/type/set.rb
card-1.99.0 tmpsets/set/mod022-rules/type/set.rb
card-1.98.3 tmpsets/set/mod022-rules/type/set.rb
card-1.98.2 tmpsets/set/mod022-rules/type/set.rb
card-1.98.1 tmpsets/set/mod022-rules/type/set.rb
card-1.98.0 tmpsets/set/mod022-rules/type/set.rb