Sha256: d2dcdd6d7301a9f9f7b4beacdb846f96b20870073abd07a03460482af975f156

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

<% format = "" %>
<% indent = 0 %>
<% entries = namespace.split('.') << protocol %>
<% entries.each_with_index do |part,count| %>
  <% indent = count %>
  <% indent.times { |c| format += "  " } %>
  <% if entries[count] == entries.last %>
    <% format += "class #{part.split("_").map { |p| p.capitalize }.join("")}Endpoint < Endpoint\n\n" %>
  <% else %>
    <% format += "module #{part.split("_").map { |p| p.capitalize }.join("")}\n" %>
  <% end %>
<% end %>
<% indent += 1 %>
<% targets.each do |target| %>
  <% case target %>
  <% when 'mysql' %>
    <% indent.times { |c| format += "  " } %>
    <% format += "extend Connection::MysqlConnection\n" %>
  <% when 'hbase' %>
    <% indent.times { |c| format += "  " } %>  
    <% format += "extend Connection::HbaseConnection\n" %>    
  <% when 'geo_index' %>
    <% indent.times { |c| format += "  " } %>  
    <% format += "extend Connection::HbaseGeoConnection\n" %> 
  <% when 'elasticsearch' %>
    <% indent.times { |c| format += "  " } %>  
    <% format += "extend Connection::ElasticSearchConnection\n" %>
  <% end %>
<% end %>
<% format += "\n" %>
<% indent.times { |c| format += "  " } %>
<% format += "Put your endpoint code here:\n\n" %>
<% indent -= 1 %>
<% while indent >= 0 %>
  <% indent.times { |c| format += "  " } %>
  <% format += "end\n" %>
  <% indent -= 1 %>
<% end %>
<%= format %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hackboxen-0.1.5 lib/hackboxen/template/endpoint.rb.erb
hackboxen-0.1.4 lib/hackboxen/template/endpoint.rb.erb
hackboxen-0.1.3 lib/hackboxen/template/endpoint.rb.erb
hackboxen-0.1.2 lib/hackboxen/template/endpoint.rb.erb
hackboxen-0.1.1 lib/hackboxen/template/endpoint.rb.erb
hackboxen-0.1.0 lib/hackboxen/template/endpoint.rb.erb