Class: Format

Inherits:
Object
  • Object
show all
Defined in:
lib/manasimu/card.rb

Constant Summary collapse

Standard =
Format.new("Standard")
Brawl =
Format.new("Brawl")
Pioneer =
Format .new("Pioneer")
Modern =
Format .new("Modern")
Legacy =
Format .new("Legacy")
Vintage =
Format .new("Vintage")
Commander =
Format .new("Commander")
Pauper =
Format .new("Pauper")
Historic =
Format .new("Historic")
Alchemy =
Format .new("Alchemy")
Explorer =
Format .new("Explorer")
@@formats =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Format

Returns a new instance of Format.



555
556
557
# File 'lib/manasimu/card.rb', line 555

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



552
553
554
# File 'lib/manasimu/card.rb', line 552

def name
  @name
end

Class Method Details

.allObject



575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
# File 'lib/manasimu/card.rb', line 575

def self.all
  return @@formats if @@formats
  @@formats = [
    Standard ,
    Brawl ,
    Pioneer ,
    Modern ,
    Legacy ,
    Vintage ,
    Commander ,
    Pauper ,
    Historic ,
    Alchemy ,
    Explorer ,
  ].sort! do |a,b| a.name <=> b.name end
end

.find(name) ⇒ Object



592
593
594
595
596
# File 'lib/manasimu/card.rb', line 592

def self.find(name)
  self.all.bsearch do |a|
    a.name >= name
  end
end

Instance Method Details

#to_sObject



559
560
561
# File 'lib/manasimu/card.rb', line 559

def to_s
  @name
end