Sha256: c97ae28254d59dd42f0eeb26dae1c1c8f8adb7959616825b062e9bff9d8d3a3f

Contents?: true

Size: 670 Bytes

Versions: 6

Compression:

Stored size: 670 Bytes

Contents

module CMS
  extend self

  def rb_all_names(dirname)
    Dir["#{RailsAdminCMS::Engine.root}/#{dirname}/*.rb"].map { |name|
      File.basename(name).sub(/\.rb$/, '')
    } +
    rb_names(dirname)
  end

  def rb_names(dirname)
    Dir["#{Rails.root}/#{dirname}/*.rb"].map do |name|
      File.basename(name).sub(/\.rb$/, '')
    end
  end

  def html_names(dirname)
    Dir["#{Rails.root}/#{dirname}/*.html.*"].map do |name|
      File.basename(name).sub(/\.html\..+$/, '').sub(/^_/, '')
    end
  end

  def dir_names(dirname)
    Dir["#{Rails.root}/#{dirname}/*"].select{ |name|
      File.directory? name
    }.map{ |name|
      name.split('/').last
    }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_admin_cms-0.0.6 lib/rails_admin_cms/utils.rb
rails_admin_cms-0.0.5 lib/rails_admin_cms/utils.rb
rails_admin_cms-0.0.4 lib/rails_admin_cms/utils.rb
rails_admin_cms-0.0.3 lib/rails_admin_cms/utils.rb
rails_admin_cms-0.0.2 lib/rails_admin_cms/utils.rb
rails_admin_cms-0.0.1 lib/rails_admin_cms/utils.rb