Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. module UI
  2.  
  3. class LabelMain
  4. attr_accessor :result
  5. @@result = ""
  6. def initialize(text, border, style)
  7. @text, @border, @style = text, border, style
  8. stylization
  9. @@result += @text
  10. end
  11.  
  12. def self.label(hash)
  13. @@result.push(Label.new(hash[name], hash[border], hash[style]))
  14. end
  15.  
  16. def horizotal(hash, &block)
  17. Horizontal.class_eval{define_method(:temp_horizontal, block)}
  18. @@result
  19. end
  20.  
  21. def vertical(hash, &block)
  22. Vertical.class_eval{define_method(:temp_vertical, block)}
  23. @@result
  24.  
  25. end
  26.  
  27. def stylization
  28. if @style.respond_to?(@style.to_sym)
  29. @text = @text.method(@style)
  30. end
  31. @text = @border.to_s + @text + @border.to_s
  32. end
  33. end
  34.  
  35. class Horizontal < LabelMain
  36.  
  37. def initialize(text, border, style)
  38. @text, @border, @style = text, border, style
  39. stylization
  40. @@result.push(@text + '\n')
  41. end
  42. end
  43.  
  44. class Vertical < LabelMain
  45. end
  46.  
  47. class TextScreen
  48.  
  49. def self.draw(&block)
  50. LabelMain.class_eval{define_method(:temp_drawer, block) }
  51. end
  52.  
  53. end
  54.  
  55.  
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement