Module: Parse

Defined in:
lib/ascension/parse.rb

Defined Under Namespace

Modules: Phrase Classes: Card, InputFile, Line, Word, Words

Class Method Summary collapse

Class Method Details

.cardsObject



9
10
11
# File 'lib/ascension/parse.rb', line 9

def self.cards
  @cards ||= InputFile.new.cards
end

.get(name) ⇒ Object



12
13
14
# File 'lib/ascension/parse.rb', line 12

def self.get(name)
  cards.find { |x| x.name == name }.tap { |x| raise "no card #{name}" unless x }
end

.reg_ability(word, ability = nil, &b) ⇒ Object



5
6
7
8
# File 'lib/ascension/parse.rb', line 5

def self.reg_ability(word,ability=nil,&b)
  ability ||= b
  Words.instance.reg_word(word) { |side| ability.call(side) }
end

.reg_word(word, &b) ⇒ Object



2
3
4
# File 'lib/ascension/parse.rb', line 2

def self.reg_word(word,&b)
  Words.instance.reg_word(word,&b)
end