vedeu 0.4.55 → 0.4.56

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu.rb +1 -1
  3. data/lib/vedeu/application.rb +2 -2
  4. data/lib/vedeu/buffers/buffer.rb +3 -3
  5. data/lib/vedeu/buffers/buffers.rb +1 -1
  6. data/lib/vedeu/buffers/display_buffer.rb +3 -3
  7. data/lib/vedeu/colours/colour.rb +1 -1
  8. data/lib/vedeu/colours/colour_translator.rb +4 -4
  9. data/lib/vedeu/configuration/api.rb +4 -4
  10. data/lib/vedeu/configuration/cli.rb +1 -1
  11. data/lib/vedeu/configuration/configuration.rb +2 -2
  12. data/lib/vedeu/cursor/cursor.rb +5 -5
  13. data/lib/vedeu/cursor/cursors.rb +1 -1
  14. data/lib/vedeu/cursor/move.rb +8 -8
  15. data/lib/vedeu/cursor/reposition.rb +2 -2
  16. data/lib/vedeu/distributed/client.rb +1 -1
  17. data/lib/vedeu/distributed/server.rb +1 -1
  18. data/lib/vedeu/distributed/test_application.rb +1 -1
  19. data/lib/vedeu/distributed/uri.rb +1 -1
  20. data/lib/vedeu/dsl/border.rb +3 -3
  21. data/lib/vedeu/dsl/composition.rb +4 -4
  22. data/lib/vedeu/dsl/geometry.rb +4 -4
  23. data/lib/vedeu/dsl/group.rb +4 -4
  24. data/lib/vedeu/dsl/interface.rb +9 -9
  25. data/lib/vedeu/dsl/keymap.rb +10 -8
  26. data/lib/vedeu/dsl/line.rb +5 -5
  27. data/lib/vedeu/dsl/stream.rb +2 -2
  28. data/lib/vedeu/dsl/use.rb +2 -2
  29. data/lib/vedeu/dsl/view.rb +7 -7
  30. data/lib/vedeu/events/event.rb +1 -1
  31. data/lib/vedeu/events/events.rb +1 -1
  32. data/lib/vedeu/geometry/geometries.rb +1 -1
  33. data/lib/vedeu/geometry/grid.rb +8 -8
  34. data/lib/vedeu/geometry/position_validator.rb +1 -1
  35. data/lib/vedeu/input/input.rb +1 -1
  36. data/lib/vedeu/input/key.rb +2 -2
  37. data/lib/vedeu/input/keymap.rb +1 -1
  38. data/lib/vedeu/input/keymaps.rb +1 -1
  39. data/lib/vedeu/input/mapper.rb +3 -3
  40. data/lib/vedeu/launcher.rb +1 -1
  41. data/lib/vedeu/log.rb +7 -7
  42. data/lib/vedeu/models/all.rb +1 -2
  43. data/lib/vedeu/models/char.rb +1 -1
  44. data/lib/vedeu/models/composition.rb +2 -2
  45. data/lib/vedeu/models/{escape_char.rb → escape.rb} +5 -5
  46. data/lib/vedeu/models/focus.rb +5 -3
  47. data/lib/vedeu/models/groups.rb +1 -1
  48. data/lib/vedeu/models/interface.rb +1 -1
  49. data/lib/vedeu/models/interfaces.rb +1 -1
  50. data/lib/vedeu/models/line.rb +2 -2
  51. data/lib/vedeu/models/menu.rb +3 -3
  52. data/lib/vedeu/models/menus.rb +1 -1
  53. data/lib/vedeu/models/stream.rb +1 -1
  54. data/lib/vedeu/output/border.rb +2 -2
  55. data/lib/vedeu/output/borders.rb +1 -1
  56. data/lib/vedeu/output/html_char.rb +42 -21
  57. data/lib/vedeu/output/refresh.rb +4 -4
  58. data/lib/vedeu/output/renderers/html.rb +22 -5
  59. data/lib/vedeu/output/renderers/renderer_options.rb +4 -0
  60. data/lib/vedeu/output/style.rb +1 -1
  61. data/lib/vedeu/output/text.rb +1 -1
  62. data/lib/vedeu/output/viewport.rb +1 -1
  63. data/lib/vedeu/output/virtual_terminal.rb +2 -1
  64. data/lib/vedeu/repositories/collection.rb +1 -1
  65. data/lib/vedeu/repositories/repository.rb +9 -5
  66. data/lib/vedeu/templating/helpers.rb +4 -4
  67. data/lib/vedeu/templating/template.rb +6 -4
  68. data/lib/vedeu/terminal.rb +2 -2
  69. data/lib/vedeu/version.rb +1 -1
  70. data/test/lib/vedeu/cursor/cursor_test.rb +2 -2
  71. data/test/lib/vedeu/models/{escape_char_test.rb → escape_test.rb} +4 -4
  72. data/test/lib/vedeu/models/group_test.rb +12 -0
  73. data/test/lib/vedeu/output/compressor_test.rb +2 -2
  74. data/test/lib/vedeu/output/html_char_test.rb +9 -2
  75. data/test/lib/vedeu/repositories/all_test.rb +21 -0
  76. data/test/lib/vedeu/repositories/repository_test.rb +2 -2
  77. metadata +6 -4
@@ -36,11 +36,11 @@ module Vedeu
36
36
  # when we define the interface or view, setting it here is just
37
37
  # mirroring functionality of {Vedeu::DSL::Border.border}.
38
38
  # @param block [Proc]
39
- # @raise [InvalidSyntax] The required block was not given.
39
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
40
40
  # @return [Vedeu::Border]
41
41
  # @see Vedeu::DSL::Border
42
42
  def border(name = nil, &block)
43
- fail InvalidSyntax, 'block not given' unless block_given?
43
+ fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
44
44
 
45
45
  model_name = name ? name : model.name
46
46
 
@@ -83,7 +83,7 @@ module Vedeu
83
83
  # # ... # is rendered.
84
84
  # end
85
85
  #
86
- # @return [Cursor]
86
+ # @return [Vedeu::Cursor]
87
87
  def cursor(value = true)
88
88
  boolean = value ? true : false
89
89
 
@@ -145,11 +145,11 @@ module Vedeu
145
145
  # when we define the interface or view, setting it here is just
146
146
  # mirroring functionality of {Vedeu::DSL::Geometry.geometry}.
147
147
  # @param block [Proc]
148
- # @raise [InvalidSyntax] The required block was not given.
149
- # @return [Geometry]
148
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
149
+ # @return [Vedeu::Geometry]
150
150
  # @see Vedeu::DSL::Geometry
151
151
  def geometry(name = nil, &block)
152
- fail InvalidSyntax, 'block not given' unless block_given?
152
+ fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
153
153
 
154
154
  model_name = name ? name : model.name
155
155
 
@@ -200,10 +200,10 @@ module Vedeu
200
200
  # end
201
201
  # end
202
202
  #
203
- # @raise [InvalidSyntax] The required block was not given.
203
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
204
204
  # @return [Line]
205
205
  def lines(&block)
206
- fail InvalidSyntax, 'block not given' unless block_given?
206
+ fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
207
207
 
208
208
  model.add(model.member.build(attributes, &block))
209
209
  end
@@ -315,7 +315,7 @@ module Vedeu
315
315
  attr_reader :client
316
316
 
317
317
  # @!attribute [r] model
318
- # @return [Interface]
318
+ # @return [Vedeu::Interface]
319
319
  attr_reader :model
320
320
 
321
321
  private
@@ -49,8 +49,8 @@ module Vedeu
49
49
  # end
50
50
  # end
51
51
  #
52
- # @raise [InvalidSyntax] The required block was not given.
53
- # @return [Keymap]
52
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
53
+ # @return [Vedeu::Keymap]
54
54
  # @todo Try to remember why we need to pre-create the keymap in the
55
55
  # repository.
56
56
  def self.keymap(name, &block)
@@ -61,7 +61,7 @@ module Vedeu
61
61
 
62
62
  # Returns an instance of DSL::Keymap.
63
63
  #
64
- # @param model [Keymap]
64
+ # @param model [Vedeu::Keymap]
65
65
  # @param client [Object]
66
66
  # @return [Vedeu::DSL::Keymap]
67
67
  def initialize(model, client = nil)
@@ -89,20 +89,22 @@ module Vedeu
89
89
  # # ...
90
90
  # end
91
91
  #
92
- # @raise [InvalidSyntax] When the required block is not given, the
92
+ # @raise [Vedeu::InvalidSyntax] When the required block is not given, the
93
93
  # value_or_values parameter is undefined, or when processing the
94
94
  # collection, a member is undefined.
95
95
  # @return [Array] A collection containing the keypress(es).
96
96
  def key(*value_or_values, &block)
97
- fail InvalidSyntax, 'No action defined for `key`.' unless block_given?
97
+ fail Vedeu::InvalidSyntax,
98
+ 'No action defined for `key`.' unless block_given?
98
99
 
99
100
  unless present?(value_or_values)
100
- fail InvalidSyntax, 'No keypress(es) defined for `key`.'
101
+ fail Vedeu::InvalidSyntax, 'No keypress(es) defined for `key`.'
101
102
  end
102
103
 
103
104
  value_or_values.each do |value|
104
105
  unless present?(value)
105
- fail InvalidSyntax, 'An invalid value for `key` was encountered.'
106
+ fail Vedeu::InvalidSyntax,
107
+ 'An invalid value for `key` was encountered.'
106
108
  end
107
109
 
108
110
  model.add(model.member.new(value, &block))
@@ -131,7 +133,7 @@ module Vedeu
131
133
  attr_reader :client
132
134
 
133
135
  # @!attribute [r] model
134
- # @return [Keymap]
136
+ # @return [Vedeu::Keymap]
135
137
  attr_reader :model
136
138
 
137
139
  end # Keymap
@@ -62,7 +62,7 @@ module Vedeu
62
62
  # end
63
63
  # end
64
64
  #
65
- # @raise [InvalidSyntax] When no block or value is provided.
65
+ # @raise [Vedeu::InvalidSyntax] When no block or value is provided.
66
66
  # @return [Vedeu::Lines]
67
67
  def line(value = '', &block)
68
68
  if block_given?
@@ -75,7 +75,7 @@ module Vedeu
75
75
  streams: [build_stream(value)])
76
76
 
77
77
  else
78
- fail InvalidSyntax, 'block not given'
78
+ fail Vedeu::InvalidSyntax, 'block not given'
79
79
 
80
80
  end
81
81
 
@@ -102,11 +102,11 @@ module Vedeu
102
102
  # end
103
103
  # end
104
104
  #
105
- # @raise [InvalidSyntax] The required block was not given.
105
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
106
106
  # @return [Vedeu::Streams<Vedeu::Stream>]
107
107
  # @see Vedeu::DSL::Stream for subdirectives.
108
108
  def streams(&block)
109
- fail InvalidSyntax, 'block not given' unless block_given?
109
+ fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
110
110
 
111
111
  model.add(model.member.build(attributes, &block))
112
112
  end
@@ -119,7 +119,7 @@ module Vedeu
119
119
  attr_reader :client
120
120
 
121
121
  # @!attribute [r] model
122
- # @return [Line]
122
+ # @return [Vedeu::Line]
123
123
  attr_reader :model
124
124
 
125
125
  private
@@ -22,10 +22,10 @@ module Vedeu
22
22
  end
23
23
 
24
24
  # @param block [Proc]
25
- # @raise [InvalidSyntax] The required block was not given.
25
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
26
26
  # @return [void]
27
27
  def stream(&block)
28
- fail InvalidSyntax, 'block not given' unless block_given?
28
+ fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
29
29
 
30
30
  model.add(model.class.build(attributes, &block))
31
31
  end
@@ -63,8 +63,8 @@ module Vedeu
63
63
  #
64
64
  # @param name [String] The name of the model with the value you wish to
65
65
  # use.
66
- # @raise [ModelNotFound|NoMethodError] The model or attribute cannot be
67
- # found.
66
+ # @raise [Vedeu::ModelNotFound|Vedeu::NoMethodError] The model or
67
+ # attribute cannot be found.
68
68
  # @return [void] The stored model.
69
69
  def use(name)
70
70
  model.repository.by_name(name)
@@ -30,10 +30,10 @@ module Vedeu
30
30
  # # ...
31
31
  # end
32
32
  #
33
- # @raise [InvalidSyntax] The required block was not given.
34
- # @return [Interface]
33
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
34
+ # @return [Vedeu::Interface]
35
35
  def interface(name = '', &block)
36
- fail InvalidSyntax, 'block not given' unless block_given?
36
+ fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
37
37
 
38
38
  attributes = { client: client(&block), name: name }
39
39
 
@@ -56,10 +56,10 @@ module Vedeu
56
56
  # end
57
57
  # end
58
58
  #
59
- # @raise [InvalidSyntax] The required block was not given.
59
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
60
60
  # @return [Array<Interface>]
61
61
  def render(&block)
62
- fail InvalidSyntax, 'block not given' unless block_given?
62
+ fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
63
63
 
64
64
  store(:store_immediate, &block)
65
65
  end
@@ -89,10 +89,10 @@ module Vedeu
89
89
  # # ...
90
90
  # end
91
91
  #
92
- # @raise [InvalidSyntax] The required block was not given.
92
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
93
93
  # @return [Array<Interface>]
94
94
  def views(&block)
95
- fail InvalidSyntax, 'block not given' unless block_given?
95
+ fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
96
96
 
97
97
  store(:store_deferred, &block)
98
98
  end
@@ -127,7 +127,7 @@ module Vedeu
127
127
  # Returns a new instance of Vedeu::Event.
128
128
  #
129
129
  # @param (see Vedeu::Event.bind)
130
- # @return [Event]
130
+ # @return [Vedeu::Event]
131
131
  def initialize(name, options = {}, closure)
132
132
  @name = name
133
133
  @options = options
@@ -3,7 +3,7 @@ module Vedeu
3
3
  # Allows the storing of events.
4
4
  #
5
5
  # @api public
6
- class Events < Repository
6
+ class Events < Vedeu::Repository
7
7
 
8
8
  class << self
9
9
 
@@ -7,7 +7,7 @@ module Vedeu
7
7
  # instance.
8
8
  #
9
9
  # @api public
10
- class Geometries < Repository
10
+ class Geometries < Vedeu::Repository
11
11
 
12
12
  class << self
13
13
 
@@ -37,11 +37,11 @@ module Vedeu
37
37
  # # 7 * 9 = 63
38
38
  # # Therefore, width is 63 characters.
39
39
  #
40
- # @raise [OutOfRange] When the value parameter is not between 1 and 12
41
- # inclusive.
42
- # @return [Fixnum|OutOfRange]
40
+ # @raise [Vedeu::OutOfRange] When the value parameter is not between 1 and
41
+ # 12 inclusive.
42
+ # @return [Fixnum|Vedeu::OutOfRange]
43
43
  def columns
44
- fail OutOfRange,
44
+ fail Vedeu::OutOfRange,
45
45
  'Valid value between 1 and 12 inclusive.' if out_of_range?
46
46
 
47
47
  column * value
@@ -56,11 +56,11 @@ module Vedeu
56
56
  # # 3 * 3 = 9
57
57
  # # Therefore, height is 9 characters.
58
58
  #
59
- # @raise [OutOfRange] When the value parameter is not between 1 and 12
60
- # inclusive.
61
- # @return [Fixnum|OutOfRange]
59
+ # @raise [Vedeu::OutOfRange] When the value parameter is not between 1 and
60
+ # 12 inclusive.
61
+ # @return [Fixnum|Vedeu::OutOfRange]
62
62
  def rows
63
- fail OutOfRange,
63
+ fail Vedeu::OutOfRange,
64
64
  'Valid value between 1 and 12 inclusive.' if out_of_range?
65
65
 
66
66
  row * value
@@ -32,7 +32,7 @@ module Vedeu
32
32
  # @param name [String]
33
33
  # @param x [Fixnum]
34
34
  # @param y [Fixnum]
35
- # @return [PositionValidator]
35
+ # @return [Vedeu::PositionValidator]
36
36
  def initialize(name, x, y)
37
37
  @name = name
38
38
  @x = x
@@ -18,7 +18,7 @@ module Vedeu
18
18
  #
19
19
  # @param reader [IO] An object that responds to `#read`. Typically, this is
20
20
  # Vedeu::Terminal.
21
- # @return [Input]
21
+ # @return [Vedeu::Input]
22
22
  def initialize(reader)
23
23
  @reader = reader
24
24
  end
@@ -14,10 +14,10 @@ module Vedeu
14
14
  #
15
15
  # @param input [String|Symbol]
16
16
  # @param block [Proc]
17
- # @raise [InvalidSyntax] The required block was not given.
17
+ # @raise [Vedeu::InvalidSyntax] The required block was not given.
18
18
  # @return [Key]
19
19
  def initialize(input = nil, &block)
20
- fail InvalidSyntax, 'block not given' unless block_given?
20
+ fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
21
21
 
22
22
  @input = input
23
23
  @output = block
@@ -32,7 +32,7 @@ module Vedeu
32
32
 
33
33
  # Add a key to the keymap.
34
34
  #
35
- # @param key [Key]
35
+ # @param key [Vedeu::Key]
36
36
  # @return [void]
37
37
  def add(key)
38
38
  return false unless valid?(key)
@@ -5,7 +5,7 @@ module Vedeu
5
5
  # Allows the storing of keymaps.
6
6
  #
7
7
  # @api public
8
- class Keymaps < Repository
8
+ class Keymaps < Vedeu::Repository
9
9
 
10
10
  class << self
11
11
 
@@ -37,8 +37,8 @@ module Vedeu
37
37
  #
38
38
  # @param key [NilClass|String|Symbol]
39
39
  # @param name [NilClass|String]
40
- # @param repository [NilClass|Repository]
41
- # @return [Mapper]
40
+ # @param repository [NilClass|Vedeu::Repository]
41
+ # @return [Vedeu::Mapper]
42
42
  def initialize(key = nil, name = nil, repository = nil)
43
43
  @key = key
44
44
  @name = name
@@ -101,7 +101,7 @@ module Vedeu
101
101
  # Fetch the named keymap from the repository.
102
102
  #
103
103
  # @param named [NilClass|String]
104
- # @return [Keymap]
104
+ # @return [Vedeu::Keymap]
105
105
  def keymap(named = name)
106
106
  repository.find(named)
107
107
  end
@@ -31,7 +31,7 @@ module Vedeu
31
31
  # @param stdout [IO]
32
32
  # @param stderr [IO]
33
33
  # @param kernel [Kernel]
34
- # @return [Launcher]
34
+ # @return [Vedeu::Launcher]
35
35
  def initialize(argv = [],
36
36
  stdin = STDIN,
37
37
  stdout = STDOUT,
@@ -25,8 +25,8 @@ module Vedeu
25
25
 
26
26
  # Returns a new instance of Vedeu::LocklessLogDevice.
27
27
  #
28
- # @param log []
29
- # @return []
28
+ # @param log [void]
29
+ # @return [void]
30
30
  def initialize(log = nil)
31
31
  @dev = nil
32
32
  @filename = nil
@@ -42,8 +42,8 @@ module Vedeu
42
42
  end
43
43
  end
44
44
 
45
- # @param message []
46
- # @return []
45
+ # @param message [String]
46
+ # @return [void]
47
47
  def write(message)
48
48
  @dev.write(message)
49
49
 
@@ -51,15 +51,15 @@ module Vedeu
51
51
  warn("log writing failed. #{exception}")
52
52
  end
53
53
 
54
- # @return []
54
+ # @return [void]
55
55
  def close
56
56
  @dev.close rescue nil
57
57
  end
58
58
 
59
59
  private
60
60
 
61
- # @param filename []
62
- # @return []
61
+ # @param filename [String]
62
+ # @return [void]
63
63
  def open_logfile(filename)
64
64
  if FileTest.exist?(filename)
65
65
  open(filename, (File::WRONLY | File::APPEND))
@@ -3,7 +3,7 @@ require 'vedeu/repositories/all'
3
3
  require 'vedeu/models/toggleable'
4
4
  require 'vedeu/models/cell'
5
5
  require 'vedeu/models/char'
6
- require 'vedeu/models/escape_char'
6
+ require 'vedeu/models/escape'
7
7
  require 'vedeu/models/stream'
8
8
  require 'vedeu/models/line'
9
9
  require 'vedeu/models/interfaces'
@@ -14,4 +14,3 @@ require 'vedeu/models/groups'
14
14
  require 'vedeu/models/group'
15
15
  require 'vedeu/models/menus'
16
16
  require 'vedeu/models/menu'
17
-
@@ -47,7 +47,7 @@ module Vedeu
47
47
  # @option attributes position [Vedeu::Position]
48
48
  # @option attributes border [NilClass|Symbol] A symbol representing the
49
49
  # border 'piece' this Char represents.
50
- # @return [Char]
50
+ # @return [Vedeu::Char]
51
51
  def initialize(attributes = {})
52
52
  @attributes = attributes
53
53
  @border = @attributes[:border]
@@ -19,9 +19,9 @@ module Vedeu
19
19
  #
20
20
  # @param attributes [Hash]
21
21
  # @option attributes colour [Vedeu::Colour]
22
- # @option attributes interfaces []
22
+ # @option attributes interfaces [void]
23
23
  # @option attributes style [Vedeu::Style]
24
- # @return [Composition]
24
+ # @return [Vedeu::Composition]
25
25
  def initialize(attributes = {})
26
26
  @attributes = defaults.merge!(attributes)
27
27
 
@@ -3,7 +3,7 @@ module Vedeu
3
3
  # Represents an invisible escape character sequence.
4
4
  #
5
5
  # @api private
6
- class EscapeChar
6
+ class Escape
7
7
 
8
8
  # @!attribute [r] value
9
9
  # @return [String]
@@ -11,10 +11,10 @@ module Vedeu
11
11
  alias_method :to_s, :value
12
12
  alias_method :to_str, :value
13
13
 
14
- # Returns a new instance of Vedeu::EscapeChar.
14
+ # Returns a new instance of Vedeu::Escape.
15
15
  #
16
16
  # @param value [String]
17
- # @return [Vedeu::EscapeChar]
17
+ # @return [Vedeu::Escape]
18
18
  def initialize(value)
19
19
  @value = value
20
20
  end
@@ -37,7 +37,7 @@ module Vedeu
37
37
  #
38
38
  # @return [String]
39
39
  def inspect
40
- "<Vedeu::EscapeChar '#{Vedeu::Esc.escape(to_s)}'>"
40
+ "<Vedeu::Escape '#{Vedeu::Esc.escape(to_s)}'>"
41
41
  end
42
42
 
43
43
  # @return [String]
@@ -50,6 +50,6 @@ module Vedeu
50
50
  ''
51
51
  end
52
52
 
53
- end # EscapeChar
53
+ end # Escape
54
54
 
55
55
  end # Vedeu