Module: Flammarion::Writeable

Defined in:
lib/cem/cflame/clickable_img.rb,
lib/cem/cflame/missing_html.rb,
lib/cem/cflame/progress.rb,
lib/cem/cflame/p.rb

Overview

Paragraph which can be updated easily as a mixin for Flammarion

Defined Under Namespace

Classes: ClickableImage, Paragraph, Progress

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cem/cflame/missing_html.rb', line 18

def method_missing(m, *args, &block)
  
  if !isHTML5Element(m)
    puts "Warning: #{m} is not a valid HTML 5 Tag"
  end    
  
  attribs = args.last.is_a?(Hash) ? args.pop.map { |key, value| %| #{key.to_s}="#{value}"| }.join : ""
  
  if args.size == 0
    puts "<#{m} #{attribs}/>", raw: true
  else
    puts args.map { |value| "<#{m} #{attribs}>#{value}</#{m}>" }.join, raw: true
  end 
end

Instance Attribute Details

#altObject

Returns the value of attribute alt.



11
12
13
# File 'lib/cem/cflame/clickable_img.rb', line 11

def alt
  @alt
end

#heightObject

Returns the value of attribute height.



11
12
13
# File 'lib/cem/cflame/clickable_img.rb', line 11

def height
  @height
end

#titleObject

Returns the value of attribute title.



11
12
13
# File 'lib/cem/cflame/clickable_img.rb', line 11

def title
  @title
end

#urlObject

Returns the value of attribute url.



11
12
13
# File 'lib/cem/cflame/clickable_img.rb', line 11

def url
  @url
end

#widthObject

Returns the value of attribute width.



11
12
13
# File 'lib/cem/cflame/clickable_img.rb', line 11

def width
  @width
end

Instance Method Details

#img_raw(url, width, height, alt, title, options = {}, &block) ⇒ Object



54
55
56
# File 'lib/cem/cflame/clickable_img.rb', line 54

def img_raw(url, width, height, alt, title, options = {}, &block)
  return ClickableImage.new(url, width, height, alt, title, @engraving.make_id, self, block)    
end

#p(text) ⇒ Object



31
32
33
34
35
# File 'lib/cem/cflame/p.rb', line 31

def p(text)
  object = Paragraph.new(text, @engraving.make_id, self)
  puts object, raw:true
  object
end

#progress(name = nil) ⇒ Object



45
46
47
# File 'lib/cem/cflame/progress.rb', line 45

def progress(name = nil)
  return Progress.new(name || @engraving.make_id, self)    
end