Class: Madness::Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/madness/theme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ Theme

Returns a new instance of Theme.



5
6
7
# File 'lib/madness/theme.rb', line 5

def initialize(path=nil)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/madness/theme.rb', line 3

def path
  @path
end

Instance Method Details

#css_source_pathObject



17
18
19
# File 'lib/madness/theme.rb', line 17

def css_source_path
  custom? ? "#{path}/styles" : 'app/styles'
end

#css_target_pathObject



21
22
23
# File 'lib/madness/theme.rb', line 21

def css_target_path
  custom? ? "#{path}/public/css" : 'app/public/css'
end

#custom?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/madness/theme.rb', line 25

def custom?
  @custom ||= (path and Dir.exist? path)
end

#public_pathObject



13
14
15
# File 'lib/madness/theme.rb', line 13

def public_path
  custom? ? "#{path}/public" : File.expand_path('../../app/public', __dir__)
end

#views_pathObject



9
10
11
# File 'lib/madness/theme.rb', line 9

def views_path
  custom? ? "#{path}/views" : File.expand_path('../../app/views', __dir__)
end