Class: Bunto::Theme

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/bunto/theme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Theme

Returns a new instance of Theme.



7
8
9
10
# File 'lib/bunto/theme.rb', line 7

def initialize(name)
  @name = name.downcase.strip
  configure_sass
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/bunto/theme.rb', line 4

def name
  @name
end

Instance Method Details

#configure_sassObject



32
33
34
35
36
# File 'lib/bunto/theme.rb', line 32

def configure_sass
  return unless sass_path
  require "sass"
  Sass.load_paths << sass_path
end

#includes_pathObject



20
21
22
# File 'lib/bunto/theme.rb', line 20

def includes_path
  path_for :includes
end

#layouts_pathObject



24
25
26
# File 'lib/bunto/theme.rb', line 24

def layouts_path
  path_for :layouts
end

#rootObject



12
13
14
15
16
17
18
# File 'lib/bunto/theme.rb', line 12

def root
  # Must use File.realpath to resolve symlinks created by rbenv

  # Otherwise, Bunto.sanitized path with prepend the unresolved root

  @root ||= File.realpath(gemspec.full_gem_path)
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
  nil
end

#sass_pathObject



28
29
30
# File 'lib/bunto/theme.rb', line 28

def sass_path
  path_for :sass
end