class Elm::Rails::Sprockets

Constants

VERSION

Attributes

cache_key[R]

Public Class Methods

cache_key() click to toggle source
# File lib/elm/rails/sprockets.rb, line 16
def self.cache_key
  instance.cache_key
end
call(input) click to toggle source
# File lib/elm/rails/sprockets.rb, line 12
def self.call(input)
  instance.call(input)
end
instance() click to toggle source
# File lib/elm/rails/sprockets.rb, line 8
def self.instance
  @instance ||= new
end
new(options = {}) click to toggle source
# File lib/elm/rails/sprockets.rb, line 22
def initialize(options = {})
  @cache_key = [self.class.name, VERSION, options].freeze
end

Public Instance Methods

call(input) click to toggle source
# File lib/elm/rails/sprockets.rb, line 26
def call(input)
  context = input[:environment].context_class.new(input)
  DependencyGraph.new(input[:filename], input[:load_path]).each do |dependency|
    context.depend_on dependency
  end
  compiled = Elm::Compiler.compile(input[:filename], debug: debug_flag)
  context.metadata.merge data: compiled
end

Private Instance Methods

debug_flag() click to toggle source
# File lib/elm/rails/sprockets.rb, line 37
def debug_flag
  case ENV['ELM_RAILS_DEBUG']
  when nil, /^false$/i, '0'
    false
  else
    true
  end
end