class Ld::Views

Attributes

headings[RW]
rows[RW]

Public Class Methods

new(root, models) click to toggle source
# File lib/ld/project/views.rb, line 4
def initialize root, models
  @root = root
  @models = models
  parse
end

Public Instance Methods

find(model_name) click to toggle source
# File lib/ld/project/views.rb, line 19
def find model_name
  @view_dirs.each do |view_dir|
    if view_dir.name == model_name.pluralize
      return Ld::View.new view_dir
    end
  end
  nil
end
parse() click to toggle source
# File lib/ld/project/views.rb, line 10
def parse
  @rows = @root.find('app/views').search_regexp(/.html/).map{|v|
    dir_name = v.parent.name
    model_name = @models.models.include?(dir_name.singularize) ? dir_name.singularize : nil
    [model_name,v.lines.size,dir_name,v.name,v.path]
  }.sort{|a,b| b[1] <=> a[1]}
  @headings = ['所属模型名','行数','文件夹名','文件名','path']
end