add Thaum.app and SomeApp.run quick-start entry points - #9
Merged
Conversation
`Thaum.app do … end` builds and runs an app from a block (an ordinary class body) in place of defining a named class; `SomeApp.run` builds and runs an instance, forwarding the same options as `Thaum.run`, which stays the primitive for apps needing constructor arguments. Deliberately minimal — no builder helpers or handler macros (one way to define handlers: plain `def`). Converts class-form examples to `.run` and hello_world to `Thaum.app`; updates README + CHANGELOG.
There was a problem hiding this comment.
Pull request overview
This PR adds quick-start entry points to make bootstrapping a Thaum app more ergonomic: Thaum.app { … } for anonymous apps and SomeApp.run for classes that include Thaum::App.
Changes:
- Add
Thaum::App::ClassMethods#runand auto-extend it oninclude Thaum::App. - Add
Thaum.app(**, &block)to build an anonymous app class from a block and run it (with a missing-block guard). - Update README, examples, changelog, and add a focused test for the new entry points.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/test_app_dsl.rb | Adds coverage for .run being added by include Thaum::App and for Thaum.app requiring a block. |
| README.md | Documents Thaum.app quick-start and updates usage to prefer SomeApp.run. |
| lib/thaum/app.rb | Extends including classes with a .run class method that instantiates and delegates to Thaum.run. |
| lib/thaum.rb | Adds Thaum.app helper that builds an anonymous Thaum::App class from a block and runs it. |
| examples/hello_world.rb | Switches the “Hello World” example to use Thaum.app do … end. |
| examples/counter.rb | Uses CounterApp.run instead of Thaum.run(CounterApp.new). |
| examples/checkbox.rb | Uses CheckboxApp.run instead of Thaum.run(CheckboxApp.new). |
| examples/layout_demo.rb | Uses LayoutDemoApp.run instead of Thaum.run(LayoutDemoApp.new). |
| examples/log_generator.rb | Uses LogGeneratorApp.run(...) instead of Thaum.run(LogGeneratorApp.new, ...). |
| examples/modal.rb | Uses ModalApp.run instead of Thaum.run(ModalApp.new). |
| examples/mouse.rb | Uses MouseApp.run instead of Thaum.run(MouseApp.new). |
| examples/progress_bar.rb | Uses ProgressApp.run instead of Thaum.run(ProgressApp.new). |
| examples/scroll_view.rb | Uses ScrollViewApp.run instead of Thaum.run(ScrollViewApp.new). |
| examples/spinner.rb | Uses SpinnerApp.run instead of Thaum.run(SpinnerApp.new). |
| examples/status_bar.rb | Uses StatusBarApp.run instead of Thaum.run(StatusBarApp.new). |
| examples/stopwatch.rb | Uses StopwatchApp.run(tick: ...) instead of Thaum.run(StopwatchApp.new, tick: ...). |
| examples/tabs.rb | Uses TabsApp.run instead of Thaum.run(TabsApp.new). |
| examples/text.rb | Uses TextApp.run instead of Thaum.run(TextApp.new). |
| examples/theme_picker.rb | Uses ThemePickerApp.run instead of Thaum.run(ThemePickerApp.new). |
| examples/todo.rb | Uses TodoApp.run instead of Thaum.run(TodoApp.new). |
| CHANGELOG.md | Notes the new Thaum.app / SomeApp.run entry points and guidance on when to still use Thaum.run(app). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A little sugar to make things a bit more approachable