Sha256: 6e6beb5773c1ebfc193c749cede6d370d02533dc2885150650100b375a8f088b

Contents?: true

Size: 539 Bytes

Versions: 6

Compression:

Stored size: 539 Bytes

Contents

module ExploreHelper 
  
  helpers do    
    
    # 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

6 entries across 6 versions & 1 rubygems

Version Path
mongo3-0.1.5 lib/helpers/explore_helper.rb
mongo3-0.1.4 lib/helpers/explore_helper.rb
mongo3-0.1.3 lib/helpers/explore_helper.rb
mongo3-0.1.2 lib/helpers/explore_helper.rb
mongo3-0.1.1 lib/helpers/explore_helper.rb
mongo3-0.1.0 lib/helpers/explore_helper.rb