Class: Briefly::Facade
- Inherits:
-
Object
- Object
- Briefly::Facade
- Defined in:
- lib/briefly/facade.rb
Overview
The object returned by define. Shortcuts are compiled onto its singleton class as real
methods, so respond_to?, console tab-completion and test stubbing all work unaided.
Memo store: reads are lock-free against a frozen snapshot hash; writes swap in a new frozen hash
under a reentrant Monitor, because a memoized body may call another memoized shortcut.
Defined Under Namespace
Classes: Control
Constant Summary collapse
- RESERVED =
Names a shortcut may not take: every facade method, plus Briefly's own private ones, plus the Kernel private methods the facade itself calls with an implicit receiver. Other Kernel privates (+puts+,
format, ...) are deliberately absent: shadowing those is the user's call. (Facade.instance_methods + Facade.private_instance_methods(false) + %i[raise]).freeze
Instance Method Summary collapse
-
#briefly ⇒ Control
The single public door to a facade's management operations, so those five names stay free for shortcuts.
-
#initialize ⇒ Facade
constructor
A new instance of Facade.
-
#inspect ⇒ String
(also: #to_s)
A summary listing shortcut names; never dumps memo internals.
Constructor Details
Instance Method Details
#briefly ⇒ Control
The single public door to a facade's management operations, so those five names stay free for shortcuts. A fresh Control each call is stateless and thread-safe — nothing to race on — and an allocation is trivial next to how rarely management runs; identity across calls is not guaranteed.
27 |
# File 'lib/briefly/facade.rb', line 27 def briefly = Control.new(self) |
#inspect ⇒ String Also known as: to_s
Returns a summary listing shortcut names; never dumps memo internals.
30 |
# File 'lib/briefly/facade.rb', line 30 def inspect = "#<#{self.class.name} shortcuts=#{__shortcuts.inspect}>" |