Class: Frame
- Inherits:
-
Object
- Object
- Frame
- Defined in:
- lib/fresnel/frame.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#footer ⇒ Object
Returns the value of attribute footer.
-
#header ⇒ Object
Returns the value of attribute header.
-
#output ⇒ Object
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(options) ⇒ Frame
constructor
A new instance of Frame.
- #to_s ⇒ Object
Constructor Details
#initialize(options) ⇒ Frame
Returns a new instance of Frame.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fresnel/frame.rb', line 6 def initialize() @header=[:header]||Array.new @body=[:body]||String.new @footer=[:footer]||Array.new @output=String.new line="+" (@@term_size-3).times{line+="-"} line+="+" collect=Array.new collect << line if header.any? header.each{|l|collect << l.chomp} collect << line end collect << "" collect += @body.chomp.wrap(@@term_size-5).split("\n") collect << "" collect << line if .any? .each{|l|collect << l.chomp} collect << line end collect.each do |l| self.output+="#{"| " unless l=~/^\+/}#{l.ljust(@@term_size-5)}#{" |" unless l=~/^\+/}\n" end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/fresnel/frame.rb', line 4 def body @body end |
#footer ⇒ Object
Returns the value of attribute footer.
4 5 6 |
# File 'lib/fresnel/frame.rb', line 4 def @footer end |
#header ⇒ Object
Returns the value of attribute header.
4 5 6 |
# File 'lib/fresnel/frame.rb', line 4 def header @header end |
#output ⇒ Object
Returns the value of attribute output.
4 5 6 |
# File 'lib/fresnel/frame.rb', line 4 def output @output end |
Instance Method Details
#to_s ⇒ Object
37 38 39 |
# File 'lib/fresnel/frame.rb', line 37 def to_s output end |