Sha256: fac17e18e6421802a5622f9b0472d4985a9dd8d16c563635f4a049d6382bcfa1

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 Bytes

Contents

module Cell
  class << self
    def to_json
      cell_name = self.to_s.sub("Cell", "").underscore
      action_methods.map do |state|
        {
          id:   "#{cell_name}/#{state.to_s}",
          name: "#{cell_name.humanize} #{state.to_s.humanize}",
        }
      end
    end

    def all
      @all ||= begin
        require_all_cells
        BaseCell.subclasses
      end
    end

    private

    def require_all_cells
      # TODO pull in cells from engines, too
      cell_files = Dir[::Rails.root.join('app/cells/*.rb')]
      cell_files.each { |cell_file| require cell_file }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nacelle-0.1.0 lib/nacelle/cells_ext.rb