Class: Gamefic::Proxy::Base
- Inherits:
-
Object
- Object
- Gamefic::Proxy::Base
- Defined in:
- lib/gamefic/proxy/base.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Instance Method Summary collapse
- #fetch(narrative) ⇒ Object
-
#initialize(*args, raise: false) ⇒ Base
constructor
A new instance of Base.
- #raise? ⇒ Boolean
- #select(narrative) ⇒ Object
Constructor Details
#initialize(*args, raise: false) ⇒ Base
Returns a new instance of Base.
8 9 10 11 |
# File 'lib/gamefic/proxy/base.rb', line 8 def initialize *args, raise: false @args = args @raise = raise end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/gamefic/proxy/base.rb', line 6 def args @args end |
Instance Method Details
#fetch(narrative) ⇒ Object
17 18 19 20 21 |
# File 'lib/gamefic/proxy/base.rb', line 17 def fetch narrative result = select(narrative) return result if result raise "#{self.class} failed for #{args.inspect}" if raise? end |
#raise? ⇒ Boolean
13 14 15 |
# File 'lib/gamefic/proxy/base.rb', line 13 def raise? @raise end |
#select(narrative) ⇒ Object
23 24 |
# File 'lib/gamefic/proxy/base.rb', line 23 def select narrative end |