Class: Gamefic::Proxy::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/gamefic/proxy/base.rb

Direct Known Subclasses

Config, Pick, PlotPick

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject (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

Returns:

  • (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