Sha256: 72c1f4ec5e9ec091ec57817a489b9c7fc948ed922c6f5f4772af34149741115e

Contents?: true

Size: 612 Bytes

Versions: 3

Compression:

Stored size: 612 Bytes

Contents

module ExploreHelper 
  
  helpers do    

    # looking at zone path?    
    def zone_path?( path )
      path.split( "|" ).size == 1
    end
    
    # compute legend title
    def legend_title( path )
      path.split( "|" ).last      
    end
    
    def path_type( path )
      tokens = path.split( "|" )
      case tokens.length 
        when 1 : "zone"
        when 2 : "database"
        else     "collection"
      end            
    end
    
    # compute legend from given path.
    def legend_for( path, count )
     "#{path_type(path)}s(<span id='count'>#{count}</span>)"
    end    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongo3-0.0.7 lib/helpers/explore_helper.rb
mongo3-0.0.6 lib/helpers/explore_helper.rb
mongo3-0.0.5 lib/helpers/explore_helper.rb