Sha256: 598a4359a34153cf5fe95c4cb040b890d5060aec81dac7913ec1bfa921ebb91a

Contents?: true

Size: 680 Bytes

Versions: 12

Compression:

Stored size: 680 Bytes

Contents

class Ld::Views
  attr_accessor :headings, :rows

  def initialize root, models
    @root = root
    @models = models
    parse
  end

  def parse
    @rows = @root.app.views.search_files(/.html/).map{|v|
      dir_name = v.father.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

  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

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ld-0.3.6 lib/ld/project/views.rb
ld-0.3.5 lib/ld/project/views.rb
ld-0.3.3 lib/ld/project/views.rb
ld-0.3.2 lib/ld/project/views.rb
ld-0.3.1 lib/ld/project/views.rb
ld-0.2.14 lib/ld/project/views.rb
ld-0.2.13 lib/ld/project/views.rb
ld-0.2.12 lib/ld/project/views.rb
ld-0.2.11 lib/ld/project/views.rb
ld-0.2.10 lib/ld/project/views.rb
ld-0.2.7 lib/ld/project/views.rb
ld-0.2.6 lib/ld/project/views.rb