Sha256: 22d46c2451ac6db1955734468cf2f5b304d6010e1f25cc8bdb8d983fcb14081b

Contents?: true

Size: 976 Bytes

Versions: 7

Compression:

Stored size: 976 Bytes

Contents

this.Skim =
  access: (name) ->
    value = @[name]
    value = value.call(@) if typeof value == "function"
    return [@]            if value == true
    return false          if value == false or !value?
    return [value]        if Object.prototype.toString.call(value) != "[object Array]"
    return false          if value.length == 0
    return value

  withContext: (context, block) ->
    create = (o) ->
      F = ->
      F.prototype = o
      new F

    context = create(context)

    context.safe ||= @safe || (value) ->
      return value if value?.skimSafe
      result = new String(value ? '')
      result.skimSafe = true
      result

    context.escape ||= @escape || (string) ->
      return '' unless string?
      return string if string.skimSafe
      @safe (''+string)
        .replace(/&/g, '&')
        .replace(/</g, '&lt;')
        .replace(/>/g, '&gt;')
        .replace(/"/g, '&quot;')
        .replace(/\//g,'&#47;')

    block.call(context)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
skim-0.8.6 vendor/assets/javascripts/skim.js.coffee
skim-0.8.5 vendor/assets/javascripts/skim.js.coffee
skim-0.8.4 vendor/assets/javascripts/skim.js.coffee
skim-0.8.3 vendor/assets/javascripts/skim.js.coffee
skim-0.8.2 vendor/assets/javascripts/skim.js.coffee
skim-0.8.1 vendor/assets/javascripts/skim.js.coffee
skim-0.8.0 vendor/assets/javascripts/skim.js.coffee