Module: Diet_Dot

Included in:
Dot_Why::Template
Defined in:
lib/Diet_Dot.rb

Instance Method Summary collapse

Instance Method Details

#dot(name, v = "") ⇒ Object



26
27
28
# File 'lib/Diet_Dot.rb', line 26

def dot name, v = ""
  text "[[=data.#{name}]]#{v || ""}"
end

#dot_array(name) ⇒ Object



34
35
36
37
38
# File 'lib/Diet_Dot.rb', line 34

def dot_array name
  text "[[~data." + name + " :v:i]]"
  yield
  text "[[~]]"
end

#dot_i(str = "i", v = nil) ⇒ Object



4
5
6
# File 'lib/Diet_Dot.rb', line 4

def dot_i str = "i", v = nil
  rawdot str, v
end

#dot_tertiary(a, b, c) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/Diet_Dot.rb', line 40

def dot_tertiary a, b, c
  rawtext "[[? #{a} ]]"
  rawdot b
  rawtext "[[??]]"
  rawdot c
  rawtext "[[?]]"
end

#dot_v(str = "v", v = nil) ⇒ Object



8
9
10
# File 'lib/Diet_Dot.rb', line 8

def dot_v str = "v", v = nil
  rawdot str, v
end

#inline_rawdot(str) ⇒ Object



12
13
14
15
16
# File 'lib/Diet_Dot.rb', line 12

def inline_rawdot str
  return( capture {
    rawtext(rawdot(str, :inline))
  })
end

#rawdot(val, v = nil) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/Diet_Dot.rb', line 18

def rawdot val, v = nil
  str = "[[=#{val}]]"
  if v === :inline
    return str
  end
  text  str + (v || "")
end

#var(*args, &blok) ⇒ Object



30
31
32
# File 'lib/Diet_Dot.rb', line 30

def var *args, &blok
  dot(*args, &blok)
end