Code Monkey home page Code Monkey logo

blocks's Introduction

Blocks

The Blocks gem is many things.

It acts as:

  • a container for reusable blocks of code and options
  • a common interface for rendering code, whether the code was defined previously in Ruby blocks, Rails partials, or proxies to other blocks of code
  • a series of hooks and wrappers that can be utilized to render code before, after, and around other blocks of code, as well as before each, after each, and around each item in a collection
  • a templating utility for easily building reusable and highly customizable UI components
  • a means for DRYing up oft-repeated code in your layouts and views
  • a simple mechanism for changing or skipping the rendering behavior for particular blocks of code

Essentially, this all boils down to the following: Blocks makes it easy to define blocks of code that can be rendered either verbatim or with replacements and modifications at some later point in time.

Build Status

Usage

Please checkout the documentation for the Blocks gem here: http://hunterae.github.io/blocks/.

Installation

Blocks requires Rails 3.0 or greater and Ruby 2.0 or greater.

Add this line to your application's Gemfile:

gem 'blocks'

And then execute:

$ bundle

Or install it yourself as:

$ gem install blocks

Development

After checking out the repo, run bundle install (and possibly gem install bundler if you don't already have bundler installed) to install dependencies. Then, run rake to run the tests. You can also run bundle console for an interactive prompt that will allow you to experiment.

Documentation

The documentation is generated using Jekyll and hosted on the Blocks gh-pages branch.

The static content is generated based on the source code within the docs directory.

To run the documentation locally or make changes for a corresponding pull request, follow the steps in the Development Section above. Then run jekyll serve and visit http://127.0.0.1:4000/blocks/.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hunterae/blocks.

License

The gem is available as open source under the terms of the MIT License.

blocks's People

Contributors

hunterae avatar vonteacher avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

blocks's Issues

Need logging of errors when rendering templates

When using
<%= blocks.use :some_module %>
results in a template called "blocks/_some_module.html.erb" being attempted to be rendered, need to report errors that they template generates rather than just outputting "Could not render template ...". This should only be the case if the template exists.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.