Sha256: 3b84fed18c93fd6c385ea93be7b06606289f52d4fb600aa90eaf821350fe769f

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

<def tag="call-tag" attrs="tag">
  <%= send(tag.gsub('-', '_'), attributes, parameters) %>
</def>


<def tag="wrap" attrs="tag, when, parameter">
  <% parameter ||= :default %>
  <%= when_ ? send(tag, attributes, { parameter.to_sym => parameters[:default] }) : parameters.default %>
</def>

    
<def tag="partial" attrs="name, locals"><%= 
   locals ||= {}
   render(:partial => name, :locals => locals.merge(:this => this))
%></def>


<def tag="repeat" attrs="even-odd, join">
  <if><%= 
    if even_odd
      context_map do
        klass = [attributes[:class], model_id_class, cycle("even", "odd")].compact.join(' ')
        element(even_odd, attributes.merge(:class => klass), parameters.default)
      end.join(join)
    else
      scope.new_scope :even_odd => "odd" do
        context_map do
          res = parameters.default
          scope.even_odd = scope.even_odd == "even" ? "odd" : "even"
          res
        end.join(join)
      end
    end %>
  </if>
</def>


<def tag="do"><%= parameters.default %></def>
<def tag="with" alias-of="do"/>


<def tag="if" attrs="test"><%= 
  test = all_attributes.fetch(:test, this)
  res = (cond = !test.blank?) ? parameters.default : ""
  Hobo::Dryml.last_if = cond
  res
%></def>


<def tag="else"><%= parameters.default unless Hobo::Dryml.last_if %></def>


<def tag="unless" attrs="test"><%= 
  test = all_attributes.fetch(:test, this)     
  res = (cond = test.blank?) ? parameters.default : ""
  Hobo::Dryml.last_if = cond
  res
%></def>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hobo-0.8.1 taglibs/core.dryml
hobo-0.8.2 taglibs/core.dryml
hobo-0.8 taglibs/core.dryml