Class: Kaminari::Generators::Theme

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/kaminari/views_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, templates) ⇒ Theme

:nodoc:



84
85
86
# File 'lib/generators/kaminari/views_generator.rb', line 84

def initialize(name, templates) #:nodoc:
  @name, @templates = name, templates.map {|f| Template.new *f}
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



83
84
85
# File 'lib/generators/kaminari/views_generator.rb', line 83

def name
  @name
end

Instance Method Details

#descriptionObject

:nodoc:



88
89
90
91
92
# File 'lib/generators/kaminari/views_generator.rb', line 88

def description #:nodoc:
  file = @templates.detect {|t| t.name == "#{name}/DESCRIPTION"}
  return "#{' ' * 12}#{name}" unless file
  open("#{SHOW_API}/#{file.sha}").read.chomp.gsub /^/, ' ' * 12
end

#templates_for(template_engine) ⇒ Object

:nodoc:



94
95
96
# File 'lib/generators/kaminari/views_generator.rb', line 94

def templates_for(template_engine) #:nodoc:
  @templates.select {|t| t.engine == template_engine}
end