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:



98
99
100
# File 'lib/generators/kaminari/views_generator.rb', line 98

def initialize(name, templates) #:nodoc:
  @name, @templates = name, templates.map {|fn, sha| Template.new fn.sub(/^#{name}\//, ''), sha}
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



97
98
99
# File 'lib/generators/kaminari/views_generator.rb', line 97

def name
  @name
end

Instance Method Details

#descriptionObject

:nodoc:



102
103
104
105
106
# File 'lib/generators/kaminari/views_generator.rb', line 102

def description #:nodoc:
  file = @templates.detect(&:description?)
  return "#{' ' * 12}#{name}" unless file
  GitHubApiHelper.get_content_for("#{@name}/#{file.name}").chomp.gsub(/^/, ' ' * 12)
end

#templates_for(template_engine) ⇒ Object

:nodoc:



108
109
110
# File 'lib/generators/kaminari/views_generator.rb', line 108

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