Module: Blissful::Rails

Defined in:
lib/blissful/rails.rb,
lib/blissful/rails/engine.rb,
lib/blissful/rails/version.rb

Defined Under Namespace

Classes: Engine

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.assets_pathObject



20
21
22
# File 'lib/blissful/rails.rb', line 20

def assets_path
  @assets_path ||= File.join gem_path, 'assets'
end

.gem_pathObject

Paths



16
17
18
# File 'lib/blissful/rails.rb', line 16

def gem_path
  @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
end

.javascripts_pathObject



24
25
26
# File 'lib/blissful/rails.rb', line 24

def javascripts_path
  File.join assets_path, 'javascripts'
end

.load!Object

Loading the heavenly library



7
8
9
10
11
12
13
# File 'lib/blissful/rails.rb', line 7

def load!
  if rails?
    loader_for_rails
  elsif sprockets?
    loader_for_sprockets
  end
end

.loader_for_railsObject

Loader for Rails



38
39
40
# File 'lib/blissful/rails.rb', line 38

def loader_for_rails
  require 'blissful/rails/engine'
end

.loader_for_sprocketsObject

Loader for Sprockets



43
44
45
# File 'lib/blissful/rails.rb', line 43

def loader_for_sprockets
  Sprockets.append_path(javascripts_path)
end

.rails?Boolean

Environment detection helpers

Returns:

  • (Boolean)


29
30
31
# File 'lib/blissful/rails.rb', line 29

def rails?
  defined?(::Rails)
end

.sprockets?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/blissful/rails.rb', line 33

def sprockets?
  defined?(::Sprockets)
end