Class: JiraMule::IssueRender

Inherits:
Mustache
  • Object
show all
Defined in:
lib/JiraMule/renderMagic.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hsh) ⇒ IssueRender

Returns a new instance of IssueRender.



5
6
7
8
9
10
11
# File 'lib/JiraMule/renderMagic.rb', line 5

def initialize(hsh)
  hsh.each_pair do |k,v|
    self.class.send(:define_method, k.to_sym) {v}
  end
  @issue = hsh
  self.class.send(:define_method, :issue) {@issue}
end

Class Method Details

.render(tmpl, issue, custom_tags = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/JiraMule/renderMagic.rb', line 18

def self.render(tmpl, issue, custom_tags={})
  r = self.new(issue.dup)
  custom_tags.each_pair do |name, blk|
    r[name.to_sym] = lambda do
      blk.call(issue.dup)
    end
  end
  r.render(tmpl)
end

Instance Method Details

#escapeHTML(str) ⇒ Object

We’re not doing HTML, so never escape.



14
15
16
# File 'lib/JiraMule/renderMagic.rb', line 14

def escapeHTML(str)
  str
end