{"id":16086680,"url":"https://github.com/astares/pharo-teachable","last_synced_at":"2025-03-18T06:30:42.021Z","repository":{"id":42082717,"uuid":"236690649","full_name":"astares/Pharo-Teachable","owner":"astares","description":"A teachable object for Pharo","archived":false,"fork":false,"pushed_at":"2024-01-23T07:48:58.000Z","size":59,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T07:49:29.745Z","etag":null,"topics":["pharo"],"latest_commit_sha":null,"homepage":null,"language":"Smalltalk","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astares.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-01-28T08:37:04.000Z","updated_at":"2022-04-13T08:45:39.000Z","dependencies_parsed_at":"2024-01-04T01:56:52.508Z","dependency_job_id":"8e754489-0bd3-4767-a253-18936e67482a","html_url":"https://github.com/astares/Pharo-Teachable","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astares%2FPharo-Teachable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astares%2FPharo-Teachable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astares%2FPharo-Teachable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astares%2FPharo-Teachable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astares","download_url":"https://codeload.github.com/astares/Pharo-Teachable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243906440,"owners_count":20367029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pharo"],"created_at":"2024-10-09T13:24:53.139Z","updated_at":"2025-03-18T06:30:41.625Z","avatar_url":"https://github.com/astares.png","language":"Smalltalk","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pharo-Teachable\n\nA **teachable object** for [Pharo](http://www.pharo.org).\n\n[![Unit Tests](https://github.com/astares/Pharo-Teachable/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/astares/Pharo-Teachable/actions/workflows/unit-tests.yml)\n[![Coverage Status](https://codecov.io/github/astares/Pharo-Teachable/coverage.svg?branch=main)](https://codecov.io/gh/astares/Pharo-Teachable/branch/main)\n[![Baseline Groups](https://github.com/astares/Pharo-Teachable/actions/workflows/loading-groups.yml/badge.svg)](https://github.com/astares/Pharo-Teachable/actions/workflows/loading-groups.yml)\n\n[![Pharo 8.0](https://img.shields.io/badge/Pharo-8.0-informational)](https://pharo.org)\n[![Pharo 9.0](https://img.shields.io/badge/Pharo-9.0-informational)](https://pharo.org)\n[![Pharo 10](https://img.shields.io/badge/Pharo-10-informational)](https://pharo.org)\n[![Pharo 11](https://img.shields.io/badge/Pharo-11-informational)](https://pharo.org)\n[![Pharo 12](https://img.shields.io/badge/Pharo-12-informational)](https://pharo.org)\n\n\n\n## Intro\n\nUsing the small project you can easily create objects responding to specific\nmessages. This is useful for mocking in unit tests and other. The code goes back\nto an early idea of [Ernest Micklei](https://github.com/emicklei) with an\nimplementation for Pharo by [Torsten Bergmann (astares)](http://www.github.com/astares).\n\n## Quick Start\n\n```Smalltalk\nMetacello new \n  repository: 'github://astares/Pharo-Teachable:main/src';\n  baseline: 'Teachable';\n  load\n```\n\n## Documentation\n\nIt's an implementation of a Teachable class who's instances can be taught to\nrespond to messages. It's useful for creating mocks who should behave like other\nobjects (for instance inside of a test case) without actually implementing a\nreal mock class. Here is an example how it can be used:\n\n```Smalltalk\n|teachable|\nteachable := Teachable new.\nteachable\n    whenSend: #help return: 'ok';\n    whenSend: #doit evaluate: [1 inspect];\n    acceptSend: #noDebugger;\n    whenSend: #negate: evaluate: [:num | num negated].\n```\n\nAfter teaching the object we can use it as if it had a normal implementation in\na class:\n\n```Smalltalk\nteachable help. \"this will return the string 'ok'\"\nteachable doit. \"this will open the inspector on the SmallInteger 1\"\nteachable noDebugger. \"this will accept the send of #noDebugger and return the teachable\"\nteachable negate: 120 \"this will return -120\"\n```\n\nsee [https://astares.blogspot.com/2005/04/teaching-behavior.html](https://astares.blogspot.com/2005/04/teaching-behavior.html)\n\n## Video\n\n[![Watch the video](https://img.youtube.com/vi/aJCX4Rpp9AU/hqdefault.jpg)](https://www.youtube.com/watch?time_continue=1\u0026v=aJCX4Rpp9AU)\n\n## Compendium\n\nAvailable in Pharo compendium\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastares%2Fpharo-teachable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastares%2Fpharo-teachable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastares%2Fpharo-teachable/lists"}