{"id":15512791,"url":"https://github.com/felipeelias/erb-view","last_synced_at":"2026-03-15T21:55:50.476Z","repository":{"id":56844738,"uuid":"80993524","full_name":"felipeelias/erb-view","owner":"felipeelias","description":"Simple wrapper around ERB that lets you create class based views.","archived":false,"fork":false,"pushed_at":"2023-10-30T04:11:08.000Z","size":26,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-06T16:57:35.795Z","etag":null,"topics":["erb","ruby","template"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/felipeelias.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-05T13:09:13.000Z","updated_at":"2023-05-30T17:32:50.000Z","dependencies_parsed_at":"2025-01-29T14:42:35.474Z","dependency_job_id":null,"html_url":"https://github.com/felipeelias/erb-view","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipeelias%2Ferb-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipeelias%2Ferb-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipeelias%2Ferb-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipeelias%2Ferb-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felipeelias","download_url":"https://codeload.github.com/felipeelias/erb-view/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240190985,"owners_count":19762599,"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":["erb","ruby","template"],"created_at":"2024-10-02T09:53:51.400Z","updated_at":"2026-03-15T21:55:50.461Z","avatar_url":"https://github.com/felipeelias.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# [Erb::View](https://felipeelias.github.io/erb-view)\n\n[![CI](https://github.com/felipeelias/erb-view/actions/workflows/ci.yml/badge.svg)](https://github.com/felipeelias/erb-view/actions/workflows/ci.yml)\n[![Gem Version](https://badge.fury.io/rb/erb-view.svg)](https://badge.fury.io/rb/erb-view)\n\nSimple wrapper around ERB that lets you create class based views.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'erb-view'\n```\n\nAnd then execute:\n\n```\n$ bundle\n```\n\nOr install it yourself as:\n\n```\n$ gem install erb-view\n```\n\n## Usage\n\n`Erb::View` lets you create reusable class based views. Start with a configuring the template directory\n\n```ruby\nErb.root = 'lib/templates'\n```\n\nAnd then define your class.\n\n```ruby\nclass IndexView\n  include Erb::View\n\n  # Reads a file named `index.erb` from the `root` specified\n  template :index\n\n  # This method is available on the ERB context\n  def title\n    'Index Page'\n  end\nend\n```\n\nIn the `root` defined, create a file named `index.erb`\n\n```html\n\u003ch1\u003e\u003c%= title %\u003e\u003c/h1\u003e\n\u003cp\u003eHello \u003c%= name %\u003e!\u003c/p\u003e\n```\n\nAnd use it in your code\n\n```ruby\nview = IndexView.new\nview.render(name: 'World')\n```\n\nThe result will be\n\n```html\n\u003ch1\u003eIndex Page\u003c/h1\u003e\n\u003cp\u003eHello World!\u003c/p\u003e\n```\n\n## Development\n\n```sh\n$ git clone git@github.com:felipeelias/erb-view.git\n$ cd erb-view\n$ bin/setup\n$ rake test\n```\n\nYou can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/felipeelias/erb-view.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipeelias%2Ferb-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelipeelias%2Ferb-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipeelias%2Ferb-view/lists"}