Class: Squib::DSL::Background
- Inherits:
-
Object
- Object
- Squib::DSL::Background
- Includes:
- WarnUnexpectedParams
- Defined in:
- lib/squib/dsl/background.rb
Instance Attribute Summary collapse
- #deck ⇒ Object readonly
- #dsl_method ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(deck, dsl_method) ⇒ Background
constructor
A new instance of Background.
- #run(opts) ⇒ Object
Methods included from WarnUnexpectedParams
Constructor Details
#initialize(deck, dsl_method) ⇒ Background
Returns a new instance of Background.
15 16 17 18 |
# File 'lib/squib/dsl/background.rb', line 15 def initialize(deck, dsl_method) @deck = deck @dsl_method = dsl_method end |
Instance Attribute Details
#deck ⇒ Object (readonly)
13 14 15 |
# File 'lib/squib/dsl/background.rb', line 13 def deck @deck end |
#dsl_method ⇒ Object (readonly)
13 14 15 |
# File 'lib/squib/dsl/background.rb', line 13 def dsl_method @dsl_method end |
Class Method Details
.accepted_params ⇒ Object
20 21 22 23 24 25 |
# File 'lib/squib/dsl/background.rb', line 20 def self.accepted_params i{ range color } end |
Instance Method Details
#run(opts) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/squib/dsl/background.rb', line 27 def run(opts) warn_if_unexpected opts range = Args.extract_range opts, deck draw = Args.extract_draw opts, deck range.each { |i| @deck.cards[i].background(draw.color[i]) } end |