Module: Tablescript::Api
- Defined in:
- lib/tablescript/api.rb
Overview
Api
Instance Method Summary collapse
- #lookup(path, roll) ⇒ Object
- #namespace(name, &blk) ⇒ Object
- #roll_on(path) ⇒ Object
- #roll_on_and_ignore(path, *args) ⇒ Object
- #roll_on_and_ignore_duplicates(path, times) ⇒ Object
- #table(name, &blk) ⇒ Object
Instance Method Details
#lookup(path, roll) ⇒ Object
46 47 48 |
# File 'lib/tablescript/api.rb', line 46 def lookup(path, roll) LookupStrategy.new(Library.instance.table(path.to_s), roll).value end |
#namespace(name, &blk) ⇒ Object
23 24 25 26 |
# File 'lib/tablescript/api.rb', line 23 def namespace(name, &blk) generator = NamespaceGenerator.new(Library.instance.root.namespace(name.to_s)) generator.instance_eval(&blk) end |
#roll_on(path) ⇒ Object
34 35 36 |
# File 'lib/tablescript/api.rb', line 34 def roll_on(path) RollStrategy.new(Library.instance.table(path.to_s)).value end |
#roll_on_and_ignore(path, *args) ⇒ Object
38 39 40 |
# File 'lib/tablescript/api.rb', line 38 def roll_on_and_ignore(path, *args) RollAndIgnoreStrategy.new(Library.instance.table(path.to_s), RpgLib::RollSet.new(*args)).value end |
#roll_on_and_ignore_duplicates(path, times) ⇒ Object
42 43 44 |
# File 'lib/tablescript/api.rb', line 42 def roll_on_and_ignore_duplicates(path, times) RollAndIgnoreDuplicatesStrategy.new(Library.instance.table(path.to_s), times).values end |