Sha256: 2ed2f515fe40b6ee98d28ccf613aa1df878abab5c9ee52e252a1a3343c823822
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
module Wassup class PaneBuilder attr_accessor :height attr_accessor :width attr_accessor :top attr_accessor :left attr_accessor :highlight attr_accessor :title attr_accessor :description attr_accessor :show_refresh attr_accessor :interval attr_accessor :content_block attr_accessor :selection_blocks attr_accessor :selection_blocks_description class ContentBuilder attr_accessor :contents def initialize(contents) @contents = contents @need_to_clear = true @show_refresh = true end def clear=(clear) @need_to_clear = clear end def add_row(display, object=nil, page:nil) if @need_to_clear @need_to_clear = false self.contents = [] end content = nil # Create contents if none if page.nil? if self.contents.empty? content = Pane::Content.new self.contents << content else content = self.contents.first end elsif page.is_a?(String) content = self.contents.find do |content| content.title == page end if content.nil? content = Pane::Content.new(page) self.contents << content end end content.add_row(display, object) end end def initialize() @height = 1 @weight = 1 @top = 0 @left = 0 @highlight = false @interval = 60 * 5 @selection_blocks = {} @selection_blocks_description = {} end def content(&block) self.content_block = block end def selection(input=10, description=nil, &block) if input.to_s.downcase == "enter" input = 10 end description_input = input if input.to_s == "10" input = "<Enter>" end self.selection_blocks[input] = block self.selection_blocks_description[input] = description end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wassup-0.2.1 | lib/wassup/pane_builder.rb |