Class: Gamefic::Proxy
- Inherits:
-
Object
- Object
- Gamefic::Proxy
- Defined in:
- lib/gamefic/proxy.rb,
lib/gamefic/proxy/base.rb,
lib/gamefic/proxy/pick.rb,
lib/gamefic/proxy/config.rb,
lib/gamefic/proxy/plot_pick.rb
Overview
TODO:
Turn this into a module after the old proxies are completely deprecated
Defined Under Namespace
Classes: Base, Config, Pick, PlotPick
Constant Summary collapse
- TYPES =
%i[attr ivar pick pick! plot_pick plot_pick! config].freeze
Instance Attribute Summary collapse
- #key ⇒ Symbol, ... readonly
- #type ⇒ Symbol readonly
Instance Method Summary collapse
- #[](key) ⇒ Object
- #fetch(narrative) ⇒ Object
-
#initialize(type, key) ⇒ Proxy
constructor
A new instance of Proxy.
Constructor Details
Instance Attribute Details
#key ⇒ Symbol, ... (readonly)
18 19 20 |
# File 'lib/gamefic/proxy.rb', line 18 def key @key end |
#type ⇒ Symbol (readonly)
15 16 17 |
# File 'lib/gamefic/proxy.rb', line 15 def type @type end |
Instance Method Details
#[](key) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/gamefic/proxy.rb', line 34 def [](key) raise ArgumentError, 'Invalid []' unless type == :config @key.push key self end |
#fetch(narrative) ⇒ Object
29 30 31 32 |
# File 'lib/gamefic/proxy.rb', line 29 def fetch narrative send(type, narrative) || raise(ArgumentError, "Unable to fetch entity from proxy agent symbol `#{key}`") end |