Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module UI
- class LabelMain
- attr_accessor :result
- @@result = ""
- def initialize(text, border, style)
- @text, @border, @style = text, border, style
- stylization
- @@result += @text
- end
- def self.label(hash)
- @@result.push(Label.new(hash[name], hash[border], hash[style]))
- end
- def horizotal(hash, &block)
- Horizontal.class_eval{define_method(:temp_horizontal, block)}
- @@result
- end
- def vertical(hash, &block)
- Vertical.class_eval{define_method(:temp_vertical, block)}
- @@result
- end
- def stylization
- if @style.respond_to?(@style.to_sym)
- @text = @text.method(@style)
- end
- @text = @border.to_s + @text + @border.to_s
- end
- end
- class Horizontal < LabelMain
- def initialize(text, border, style)
- @text, @border, @style = text, border, style
- stylization
- @@result.push(@text + '\n')
- end
- end
- class Vertical < LabelMain
- end
- class TextScreen
- def self.draw(&block)
- LabelMain.class_eval{define_method(:temp_drawer, block) }
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement