Module: Clot::TagHelper

Included in:
ClotTag, ErrorMessagesFor, LinkItem, LinksBlock, LiquidForm
Defined in:
lib/clot/tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#resolve_value(value, context) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/clot/tag_helper.rb', line 7

def resolve_value(value,context)
  case value
    when /^([\[])(.*)([\]])$/ then array =  $2.split " "; array.map { |item| resolve_value item, context }
    when /^(["'])(.*)\1$/ then $2
    when /^(\d+[\.]\d+)$/ then $1.to_f
    when /^(\d+)$/ then value.to_i
    when /^true$/ then true
    when /^false$/ then false
    when /^nil$/ then nil
    when /^(.+)_path$/ then "/#{$1}"
    else context[value]
  end
end

#split_params(params) ⇒ Object



3
4
5
# File 'lib/clot/tag_helper.rb', line 3

def split_params(params)
  params.split(",").map(&:strip)
end