No commit activity in last 3 years
No release in over 3 years
Use helpers anywhere with the Helper class.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 5.1.2
~> 10.0
~> 3.0
~> 0.49.1
 Project Readme

Rails Helper Anywhere

Rails Helper Anywhere allows you to access ALL Ruby On Rails helpers. All methods are placed on the class Helper as class methods.

Installation

Add this line to your application's Gemfile:

gem 'rails_helper_anywhere'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rails_helper_anywhere

Usage

To use Rails Helpers just place them as class methods on the class Helper.

# Examples of some helpers

Helper.link_to('Home', '/') #=> '<a href="/">home page</a>'
Helper.pins_path #=> '/pins'
Helper.method_from_custom_helpers #=> 'return from custom method in ApplicationHelper module'

The Helper Class is most useful in custom classes or custom tests. Instead of including the helper modules that you need, just use the Helper class methods.

class MyCustomClass
  def my_method_root_path
    Helper.root_path
  end
end

RSpec.describe MyCustomClass do
  describe '#my_method_root_path' do
    it 'returns root path' do
      expect(Helper.root_path).to eq(MyCustomClass.new.my_method_root_path)
    end
  end
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jwipeout/rails-helper-anywhere. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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