Class: MonkeysPaw::Application
- Inherits:
-
Object
- Object
- MonkeysPaw::Application
- Defined in:
- lib/monkeyspaw/application.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#root ⇒ Object
Returns the value of attribute root.
-
#router ⇒ Object
Returns the value of attribute router.
Instance Method Summary collapse
- #assets_dir ⇒ Object
- #cache_manager ⇒ Object
- #components_dir ⇒ Object
- #configure {|config| ... } ⇒ Object
- #get_component_prompt(path) ⇒ Object
- #get_page_prompt(path) ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #pages_dir ⇒ Object
- #pick_up!(**options) ⇒ Object
- #prompt_manager ⇒ Object
- #use(provider, **options) ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
8 9 10 11 12 13 14 15 |
# File 'lib/monkeyspaw/application.rb', line 8 def initialize @config = Config.new @root = Pathname.new(Dir.pwd) @server = nil @router = nil @prompt_manager = nil @cache_manager = nil end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/monkeyspaw/application.rb', line 5 def config @config end |
#root ⇒ Object
Returns the value of attribute root.
6 7 8 |
# File 'lib/monkeyspaw/application.rb', line 6 def root @root end |
#router ⇒ Object
Returns the value of attribute router.
6 7 8 |
# File 'lib/monkeyspaw/application.rb', line 6 def router @router end |
Instance Method Details
#assets_dir ⇒ Object
55 56 57 |
# File 'lib/monkeyspaw/application.rb', line 55 def assets_dir root.join(config.assets_dir || 'assets') end |
#cache_manager ⇒ Object
21 22 23 |
# File 'lib/monkeyspaw/application.rb', line 21 def cache_manager @cache_manager ||= CacheManager.new(self) end |
#components_dir ⇒ Object
51 52 53 |
# File 'lib/monkeyspaw/application.rb', line 51 def components_dir root.join(config.components_dir || 'components') end |
#configure {|config| ... } ⇒ Object
25 26 27 28 |
# File 'lib/monkeyspaw/application.rb', line 25 def configure yield config if block_given? self end |
#get_component_prompt(path) ⇒ Object
63 64 65 |
# File 'lib/monkeyspaw/application.rb', line 63 def get_component_prompt(path) @prompt_manager.get_component_prompt(path) end |
#get_page_prompt(path) ⇒ Object
59 60 61 |
# File 'lib/monkeyspaw/application.rb', line 59 def get_page_prompt(path) @prompt_manager.get_page_prompt(path) end |
#pages_dir ⇒ Object
47 48 49 |
# File 'lib/monkeyspaw/application.rb', line 47 def pages_dir root.join(config.pages_dir || 'wishes') end |
#pick_up!(**options) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/monkeyspaw/application.rb', line 34 def pick_up!(**) setup_directories apply_ai_configuration @router ||= Router.new(self) # Initialize prompt manager prompt_manager @server ||= Server.new(self, **) @server.start end |
#prompt_manager ⇒ Object
17 18 19 |
# File 'lib/monkeyspaw/application.rb', line 17 def prompt_manager @prompt_manager ||= PromptManager.new(self) end |
#use(provider, **options) ⇒ Object
30 31 32 |
# File 'lib/monkeyspaw/application.rb', line 30 def use(provider, **) puts "Use called" end |