Sha256: 99e164b3e892c93c2af5898aca01612e40ccd40cf83f16f1036aff3364821ea3

Contents?: true

Size: 641 Bytes

Versions: 2

Compression:

Stored size: 641 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

2 entries across 2 versions & 1 rubygems

Version Path
mongo3-0.0.9 lib/helpers/explore_helper.rb
mongo3-0.0.8 lib/helpers/explore_helper.rb