Skip to content

Commit

Permalink
Autoload the parsers on first use
Browse files Browse the repository at this point in the history
Adding this gem to an application should probably load the gettext
parsing utilities when it's being used at runtime.  Currently, the
gem entry lib file requires parser which eager loads these parsers
and consumes time and memory when the developer or system may not
need them.
  • Loading branch information
jrafanie committed May 10, 2024
1 parent da03f54 commit b32fae8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/gettext_i18n_rails_js/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

require_relative "parser/base"
require_relative "parser/javascript"
require_relative "parser/handlebars"

module GettextI18nRailsJs
module Parser
autoload(:Base, "gettext_i18n_rails_js/parser/base")
autoload(:Javascript, "gettext_i18n_rails_js/parser/javascript")
autoload(:Handlebars, "gettext_i18n_rails_js/parser/handlebars")
end
end

0 comments on commit b32fae8

Please sign in to comment.