Module: Mutton::Config

Included in:
Mutton
Defined in:
lib/mutton/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#handlebars_fileObject

handlebars file for compilation change this if you want to use a beta or other version you dont need to wait for a gem update if handlebars releases a new version



38
39
40
41
# File 'lib/mutton/config.rb', line 38

def handlebars_file
  # don't want to force the user to serve my handlebars.js from sprockets so...
  @handlebars_file ||= File.expand_path('../../../vendor/assets/javascripts/mutton/handlebars.js', __FILE__)
end

#javascript_asset_path=(value) ⇒ Object (writeonly)

Sets the attribute javascript_asset_path

Parameters:

  • value

    the value to set the attribute javascript_asset_path to.



3
4
5
# File 'lib/mutton/config.rb', line 3

def javascript_asset_path=(value)
  @javascript_asset_path = value
end

#loggerObject

provide a custom logger if you are magically using this from outside rails. logger is set during engine configuration ti Rails.logger



8
9
10
# File 'lib/mutton/config.rb', line 8

def logger
  @logger
end

#template_namespaceObject

javascript namespace for compiled templates templates will be accessed by this value JHT



30
31
32
# File 'lib/mutton/config.rb', line 30

def template_namespace
  @template_namespace ||= 'JHT'
end

#template_pathObject

path to templates directory



15
16
17
18
# File 'lib/mutton/config.rb', line 15

def template_path
  @template_path ||= Rails.root.join('app', 'assets', 'javascripts', 'templates')
  # @template_path ||= Rails.root.join('app', 'handlebars', 'templates')
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



10
11
12
# File 'lib/mutton/config.rb', line 10

def configure
  yield self
end

#default_template_pathObject

shipped default path



59
60
61
62
# File 'lib/mutton/config.rb', line 59

def default_template_path
  # Rails.root.join('app', 'handlebars', 'templates')
  Rails.root.join('app', 'assets', 'javascripts', 'templates')
end

#helper_pathObject

path to javascript helpers every javascript file in this directory will be concatenated with handlebars during compilation



23
24
25
# File 'lib/mutton/config.rb', line 23

def helper_path
  @helper_path ||= File.join(Mutton.template_path, 'helpers')
end

#sprockets_pathObject

sprockets needs to know where hbs files are stored its 1 up from the template path in sprockets-speak



54
55
56
# File 'lib/mutton/config.rb', line 54

def sprockets_path
  File.expand_path('../', Mutton.template_path)
end

#subscribe_notificationsObject Also known as: subscribe_notifications?

when true, instrumentation will be logged at debug level



44
45
46
# File 'lib/mutton/config.rb', line 44

def subscribe_notifications
  @subscribe_notifications ||= true
end

#vendor_versionObject

shipped version of handlebars



65
66
67
# File 'lib/mutton/config.rb', line 65

def vendor_version
  'v3.0.3'
end