glimmer-dsl-opal 0.5.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -0
  3. data/README.md +438 -17
  4. data/VERSION +1 -1
  5. data/app/assets/images/glimmer/images/calendar.gif +0 -0
  6. data/app/assets/images/glimmer/images/ui-icons_222222_256x240.png +0 -0
  7. data/app/assets/images/glimmer/images/ui-icons_444444_256x240.png +0 -0
  8. data/app/assets/images/glimmer/images/ui-icons_555555_256x240.png +0 -0
  9. data/app/assets/images/glimmer/images/ui-icons_777620_256x240.png +0 -0
  10. data/app/assets/images/glimmer/images/ui-icons_777777_256x240.png +0 -0
  11. data/app/assets/images/glimmer/images/ui-icons_cc0000_256x240.png +0 -0
  12. data/app/assets/images/glimmer/images/ui-icons_ffffff_256x240.png +0 -0
  13. data/app/assets/stylesheets/glimmer/glimmer.css +15 -0
  14. data/app/assets/stylesheets/glimmer/jquery-ui.css +1312 -0
  15. data/app/assets/stylesheets/glimmer/jquery-ui.structure.css +886 -0
  16. data/app/assets/stylesheets/glimmer/jquery-ui.theme.css +443 -0
  17. data/app/assets/stylesheets/glimmer/jquery.ui.timepicker.css +57 -0
  18. data/lib/display.rb +31 -0
  19. data/lib/file.rb +29 -0
  20. data/lib/glimmer-dsl-opal.rb +40 -8
  21. data/lib/glimmer-dsl-opal/ext/date.rb +49 -3
  22. data/lib/glimmer-dsl-opal/ext/struct.rb +37 -0
  23. data/lib/glimmer-dsl-opal/samples/elaborate/tic_tac_toe.rb +23 -0
  24. data/lib/glimmer-dsl-opal/samples/hello/hello_date_time.rb +63 -0
  25. data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +283 -0
  26. data/lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/GPL-LICENSE.txt +278 -0
  27. data/lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/MIT-LICENSE.txt +20 -0
  28. data/lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/jquery.ui.timepicker.css +57 -0
  29. data/lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/jquery.ui.timepicker.js +1496 -0
  30. data/lib/glimmer-dsl-opal/vendor/jquery-ui/AUTHORS.txt +333 -0
  31. data/lib/glimmer-dsl-opal/vendor/jquery-ui/LICENSE.txt +43 -0
  32. data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_444444_256x240.png +0 -0
  33. data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_555555_256x240.png +0 -0
  34. data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_777620_256x240.png +0 -0
  35. data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_777777_256x240.png +0 -0
  36. data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_cc0000_256x240.png +0 -0
  37. data/lib/glimmer-dsl-opal/vendor/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
  38. data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min.css +7 -0
  39. data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min.js +13 -0
  40. data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.structure.min.css +5 -0
  41. data/lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.theme.min.css +5 -0
  42. data/lib/glimmer-dsl-opal/vendor/jquery-ui/package.json +74 -0
  43. data/lib/glimmer-dsl-swt.rb +20 -35
  44. data/lib/glimmer/data_binding/table_items_binding.rb +32 -19
  45. data/lib/glimmer/dsl/opal/block_property_expression.rb +41 -0
  46. data/lib/glimmer/dsl/opal/custom_widget_expression.rb +1 -1
  47. data/lib/glimmer/dsl/opal/dsl.rb +2 -0
  48. data/lib/glimmer/dsl/opal/shell_expression.rb +7 -2
  49. data/lib/glimmer/dsl/opal/widget_expression.rb +10 -1
  50. data/lib/glimmer/engine.rb +9 -0
  51. data/lib/glimmer/swt.rb +3 -3
  52. data/lib/glimmer/swt/button_proxy.rb +5 -5
  53. data/lib/glimmer/swt/checkbox_proxy.rb +1 -0
  54. data/lib/glimmer/swt/color_proxy.rb +45 -45
  55. data/lib/glimmer/swt/combo_proxy.rb +42 -3
  56. data/lib/glimmer/swt/composite_proxy.rb +7 -3
  57. data/lib/glimmer/swt/control_editor.rb +54 -0
  58. data/lib/glimmer/swt/date_time_proxy.rb +209 -0
  59. data/lib/glimmer/swt/display_proxy.rb +6 -2
  60. data/lib/glimmer/swt/fill_layout_proxy.rb +1 -1
  61. data/lib/glimmer/swt/label_proxy.rb +2 -2
  62. data/lib/glimmer/swt/layout_data_proxy.rb +13 -10
  63. data/lib/glimmer/swt/layout_proxy.rb +5 -5
  64. data/lib/glimmer/swt/list_proxy.rb +2 -2
  65. data/lib/glimmer/swt/make_shift_shell_proxy.rb +4 -4
  66. data/lib/glimmer/swt/message_box_proxy.rb +10 -8
  67. data/lib/glimmer/swt/property_owner.rb +2 -2
  68. data/lib/glimmer/swt/radio_proxy.rb +1 -0
  69. data/lib/glimmer/swt/shell_proxy.rb +8 -0
  70. data/lib/glimmer/swt/tab_folder_proxy.rb +5 -5
  71. data/lib/glimmer/swt/tab_item_proxy.rb +7 -7
  72. data/lib/glimmer/swt/table_column_proxy.rb +71 -12
  73. data/lib/glimmer/swt/table_editor.rb +65 -0
  74. data/lib/glimmer/swt/table_item_proxy.rb +50 -7
  75. data/lib/glimmer/swt/table_proxy.rb +595 -22
  76. data/lib/glimmer/swt/text_proxy.rb +51 -3
  77. data/lib/glimmer/swt/widget_proxy.rb +141 -27
  78. data/lib/glimmer/ui/custom_widget.rb +8 -8
  79. data/lib/net/http.rb +1 -5
  80. data/lib/os.rb +36 -0
  81. data/lib/uri.rb +3 -3
  82. metadata +49 -9
  83. data/lib/glimmer/data_binding/ext/observable_model.rb +0 -40
@@ -20,13 +20,61 @@ module Glimmer
20
20
  event: 'keyup',
21
21
  event_handler: -> (event_listener) {
22
22
  -> (event) {
23
+ # TODO consider unifying this event handler with on_key_pressed by relying on its result instead of hooking another keyup event
24
+ if @last_key_pressed_event.nil? || @last_key_pressed_event.doit
25
+ @text = event.target.value
26
+ event_listener.call(event)
27
+ else
28
+ # TODO Fix doit false, it's not stopping input
29
+ event.prevent
30
+ event.prevent_default
31
+ event.stop_propagation
32
+ event.stop_immediate_propagation
33
+ end
34
+ }
35
+ }
36
+ },
37
+ 'on_key_pressed' => {
38
+ event: 'keydown',
39
+ event_handler: -> (event_listener) {
40
+ -> (event) {
41
+ @last_key_pressed_event = event
23
42
  @text = event.target.value
24
- event_listener.call(event)
43
+ # TODO generalize this solution to all widgets that support key presses
44
+ # TODO support event.location once DOM3 is supported by opal-jquery
45
+ event.define_singleton_method(:keyCode) {event.which}
46
+ event.define_singleton_method(:key_code, &event.method(:keyCode))
47
+ event.define_singleton_method(:character) {event.which.chr}
48
+ event.define_singleton_method(:stateMask) do
49
+ state_mask = 0
50
+ state_mask |= SWTProxy[:alt] if event.alt_key
51
+ state_mask |= SWTProxy[:ctrl] if event.ctrl_key
52
+ state_mask |= SWTProxy[:shift] if event.shift_key
53
+ state_mask |= SWTProxy[:command] if event.meta_key
54
+ state_mask
55
+ end
56
+ event.define_singleton_method(:state_mask, &event.method(:stateMask))
57
+ doit = true
58
+ event.define_singleton_method(:doit=) do |value|
59
+ doit = value
60
+ end
61
+ event.define_singleton_method(:doit) { doit }
62
+ event_listener.call(event)
63
+
64
+ # TODO Fix doit false, it's not stopping input
65
+ unless doit
66
+ event.prevent
67
+ event.prevent_default
68
+ event.stop_propagation
69
+ event.stop_immediate_propagation
70
+ end
71
+
72
+ doit
25
73
  }
26
74
  }
27
- }
75
+ },
28
76
  }
29
- end
77
+ end
30
78
 
31
79
  def dom
32
80
  text_text = @text
@@ -29,13 +29,16 @@ module Glimmer
29
29
  include Glimmer
30
30
  include PropertyOwner
31
31
 
32
- attr_reader :parent, :args, :path, :children, :enabled, :foreground, :background, :font, :focus
32
+ attr_reader :parent, :args, :path, :children, :enabled, :foreground, :background, :font, :focus, :disposed?, :rendered
33
+ alias isDisposed disposed?
34
+ alias is_disposed disposed?
35
+ alias rendered? rendered
33
36
 
34
37
  class << self
35
38
  # Factory Method that translates a Glimmer DSL keyword into a WidgetProxy object
36
- def for(keyword, parent, args)
39
+ def for(keyword, parent, args, block)
37
40
  the_widget_class = widget_class(keyword)
38
- the_widget_class.respond_to?(:create) ? the_widget_class.create(parent, args) : the_widget_class.new(parent, args)
41
+ the_widget_class.respond_to?(:create) ? the_widget_class.create(keyword, parent, args, block) : the_widget_class.new(parent, args, block)
39
42
  end
40
43
 
41
44
  def widget_class(keyword)
@@ -97,21 +100,69 @@ module Glimmer
97
100
  # end,
98
101
  }
99
102
 
100
- def initialize(parent, args)
103
+ def initialize(parent, args, block)
101
104
  @parent = parent
102
105
  @args = args
106
+ @block = block
103
107
  @children = Set.new # TODO consider moving to composite
104
108
  @enabled = true
109
+ @data = {}
105
110
  DEFAULT_INITIALIZERS[self.class.underscored_widget_name(self)]&.call(self)
106
- @parent.add_child(self) # TODO rename to post_initialize_child to be closer to glimmer-dsl-swt terminology
111
+ @parent.post_initialize_child(self) # TODO rename to post_initialize_child to be closer to glimmer-dsl-swt terminology
107
112
  end
108
113
 
114
+ # Executes for the parent of a child that just got added
115
+ def post_initialize_child(child)
116
+ @children << child
117
+ child.render
118
+ end
119
+
120
+ # Executes for the parent of a child that just got disposed
121
+ def post_dispose_child(child)
122
+ @children&.delete(child)
123
+ end
124
+
125
+ # Executes at the closing of a parent widget curly braces after all children/properties have been added/set
126
+ def post_add_content
127
+ # No Op by default
128
+ end
129
+
130
+ def set_data(key=nil, value)
131
+ @data[key] = value
132
+ end
133
+ alias setData set_data
134
+ alias data= set_data
135
+
136
+ def get_data(key=nil)
137
+ @data[key]
138
+ end
139
+ alias getData get_data
140
+ alias data get_data
141
+
109
142
  def css_classes
110
143
  dom_element.attr('class').to_s.split
111
144
  end
112
145
 
113
146
  def dispose
147
+ remove_all_listeners
114
148
  Document.find(path).remove
149
+ parent&.post_dispose_child(self)
150
+ # TODO fire on_widget_disposed listener
151
+ @disposed = true
152
+ end
153
+
154
+ def remove_all_listeners
155
+ effective_observation_request_to_event_mapping.keys.each do |keyword|
156
+ [effective_observation_request_to_event_mapping[keyword]].flatten.each do |mapping|
157
+ observation_requests[keyword].to_a.each do |event_listener|
158
+ event = mapping[:event]
159
+ event_handler = mapping[:event_handler]
160
+ event_element_css_selector = mapping[:event_element_css_selector]
161
+ the_listener_dom_element = event_element_css_selector ? Element[event_element_css_selector] : listener_dom_element
162
+ the_listener_dom_element.off(event)
163
+ end
164
+ end
165
+ end
115
166
  end
116
167
 
117
168
  def path
@@ -123,11 +174,6 @@ module Glimmer
123
174
  'div'
124
175
  end
125
176
 
126
- def add_child(child)
127
- @children << child
128
- child.render
129
- end
130
-
131
177
  def enabled=(value)
132
178
  @enabled = value
133
179
  dom_element.prop('disabled', !@enabled)
@@ -165,31 +211,52 @@ module Glimmer
165
211
  @parent.path
166
212
  end
167
213
 
168
- def render
214
+ def parent_dom_element
215
+ Document.find(parent_path)
216
+ end
217
+
218
+ def render(custom_parent_dom_element = nil)
219
+ the_parent_dom_element = custom_parent_dom_element || parent_dom_element
169
220
  old_element = dom_element
170
221
  brand_new = @dom.nil? || old_element.empty?
171
- build_dom
222
+ build_dom(!custom_parent_dom_element) # TODO handle custom parent layout by passing parent instead of parent dom element
172
223
  if brand_new
173
- Document.find(parent_path).append(@dom)
224
+ the_parent_dom_element.append(@dom)
174
225
  else
175
226
  old_element.replace_with(@dom)
176
227
  end
177
- @observation_requests&.clone&.each do |keyword, event_listener_set|
228
+ observation_requests&.clone&.each do |keyword, event_listener_set|
178
229
  event_listener_set.each do |event_listener|
179
- @observation_requests[keyword].delete(event_listener)
230
+ observation_requests[keyword].delete(event_listener) # TODO look into the implications of this and if it's needed.
180
231
  handle_observation_request(keyword, &event_listener)
181
232
  end
182
233
  end
183
234
  children.each do |child|
184
235
  child.render
185
236
  end
237
+ @rendered = true
238
+ content_on_render_blocks.each { |content_block| content(&content_block) }
186
239
  end
187
240
  alias redraw render
188
241
 
189
- def build_dom
242
+ def content_on_render_blocks
243
+ @content_on_render_blocks ||= []
244
+ end
245
+
246
+ def add_content_on_render(&content_block)
247
+ if rendered?
248
+ content_block.call
249
+ else
250
+ content_on_render_blocks << content_block
251
+ end
252
+ end
253
+
254
+ def build_dom(layout=true)
255
+ # TODO consider passing parent element instead and having table item include a table cell widget only for opal
190
256
  @dom = nil
191
257
  @dom = dom
192
258
  @dom = @parent.layout.dom(@dom) if @parent.respond_to?(:layout) && @parent.layout
259
+ @dom
193
260
  end
194
261
 
195
262
  def content(&block)
@@ -201,6 +268,21 @@ module Glimmer
201
268
  {}
202
269
  end
203
270
 
271
+ def effective_observation_request_to_event_mapping
272
+ default_observation_request_to_event_mapping.merge(observation_request_to_event_mapping)
273
+ end
274
+
275
+ def default_observation_request_to_event_mapping
276
+ {
277
+ 'on_focus_gained' => {
278
+ event: 'focus',
279
+ },
280
+ 'on_focus_lost' => {
281
+ event: 'blur',
282
+ },
283
+ }
284
+ end
285
+
204
286
  def name
205
287
  self.class.name.split('::').last.underscore.sub(/_proxy$/, '').gsub('_', '-')
206
288
  end
@@ -248,6 +330,8 @@ module Glimmer
248
330
  Document.find(path)
249
331
  end
250
332
 
333
+ # TODO consider adding a default #dom method implementation for the common case, automatically relying on #element and other methods to build the dom html
334
+
251
335
  def style_element
252
336
  style_element_id = "#{id}-style"
253
337
  style_element_selector = "style##{style_element_id}"
@@ -262,10 +346,6 @@ module Glimmer
262
346
  element
263
347
  end
264
348
 
265
- def parent_dom_element
266
- Document.find(parent_path)
267
- end
268
-
269
349
  def listener_path
270
350
  path
271
351
  end
@@ -287,26 +367,36 @@ module Glimmer
287
367
  end
288
368
  end
289
369
 
290
- def handle_observation_request(keyword, &event_listener)
291
- return unless observation_request_to_event_mapping.keys.include?(keyword)
370
+ def observation_requests
292
371
  @observation_requests ||= {}
293
- @observation_requests[keyword] ||= Set.new
372
+ end
373
+
374
+ def handle_observation_request(keyword, &event_listener)
375
+ return unless effective_observation_request_to_event_mapping.keys.include?(keyword)
294
376
  event = nil
295
377
  delegate = nil
296
- [observation_request_to_event_mapping[keyword]].flatten.each do |mapping|
297
- @observation_requests[keyword] << event_listener
378
+ [effective_observation_request_to_event_mapping[keyword]].flatten.each do |mapping|
379
+ observation_requests[keyword] ||= Set.new
380
+ observation_requests[keyword] << event_listener
298
381
  event = mapping[:event]
299
382
  event_handler = mapping[:event_handler]
383
+ event_element_css_selector = mapping[:event_element_css_selector]
300
384
  potential_event_listener = event_handler&.call(event_listener)
301
385
  event_listener = potential_event_listener || event_listener
302
- delegate = listener_dom_element.on(event, &event_listener)
386
+ async_event_listener = lambda do |event|
387
+ Async::Task.new do
388
+ event_listener.call(event)
389
+ end
390
+ end
391
+ the_listener_dom_element = event_element_css_selector ? Element[event_element_css_selector] : listener_dom_element
392
+ delegate = the_listener_dom_element.on(event, &async_event_listener)
303
393
  end
304
394
  # TODO update code below for new WidgetProxy API
305
395
  EventListenerProxy.new(element_proxy: self, event: event, selector: selector, delegate: delegate)
306
396
  end
307
397
 
308
398
  def add_observer(observer, property_name)
309
- property_listener_installers = self.class.ancestors.map {|ancestor| widget_property_listener_installers[ancestor]}.compact
399
+ property_listener_installers = self.class&.ancestors&.to_a.map {|ancestor| widget_property_listener_installers[ancestor]}.compact
310
400
  widget_listener_installers = property_listener_installers.map{|installer| installer[property_name.to_s.to_sym]}.compact if !property_listener_installers.empty?
311
401
  widget_listener_installers.to_a.each do |widget_listener_installer|
312
402
  widget_listener_installer.call(observer)
@@ -318,6 +408,14 @@ module Glimmer
318
408
  super(attribute_name, *args) # PropertyOwner
319
409
  end
320
410
 
411
+ def method_missing(method, *args, &block)
412
+ if method.to_s.start_with?('on_')
413
+ handle_observation_request(method, &block)
414
+ else
415
+ super(method, *args, &block)
416
+ end
417
+ end
418
+
321
419
  def apply_property_type_converters(attribute_name, args)
322
420
  if args.count == 1
323
421
  value = args.first
@@ -458,6 +556,13 @@ module Glimmer
458
556
  # }
459
557
  # end,
460
558
  # },
559
+ DateTimeProxy => {
560
+ :date_time => lambda do |observer|
561
+ on_widget_selected { |selection_event|
562
+ observer.call(date_time)
563
+ }
564
+ end
565
+ },
461
566
  RadioProxy => { #radio?
462
567
  :selection => lambda do |observer|
463
568
  on_widget_selected { |selection_event|
@@ -465,6 +570,13 @@ module Glimmer
465
570
  }
466
571
  end
467
572
  },
573
+ TableProxy => {
574
+ :selection => lambda do |observer|
575
+ on_widget_selected { |selection_event|
576
+ observer.call(selection_event.table_item.get_data) # TODO ensure selection doesn't conflict with editing
577
+ }
578
+ end,
579
+ },
468
580
  # Java::OrgEclipseSwtWidgets::MenuItem => {
469
581
  # :selection => lambda do |observer|
470
582
  # on_widget_selected { |selection_event|
@@ -486,11 +598,13 @@ module Glimmer
486
598
  end
487
599
  end
488
600
 
601
+ require 'glimmer/swt/display_proxy'
489
602
  require 'glimmer/swt/browser_proxy'
490
603
  require 'glimmer/swt/button_proxy'
491
604
  require 'glimmer/swt/combo_proxy'
492
605
  require 'glimmer/swt/checkbox_proxy'
493
606
  require 'glimmer/swt/composite_proxy'
607
+ require 'glimmer/swt/date_time_proxy'
494
608
  require 'glimmer/swt/group_proxy'
495
609
  require 'glimmer/swt/label_proxy'
496
610
  require 'glimmer/swt/list_proxy'
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2020 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -89,7 +89,7 @@ module Glimmer
89
89
  def included(klass)
90
90
  klass.extend(ClassMethods)
91
91
  unless klass.name.include?('Glimmer::UI::CustomShell')
92
- klass.include(Glimmer)
92
+ klass.include(Glimmer)
93
93
  Glimmer::UI::CustomWidget.add_custom_widget_namespaces_for(klass)
94
94
  end
95
95
  end
@@ -107,7 +107,7 @@ module Glimmer
107
107
  end
108
108
  begin
109
109
  constant = result.const_get(namespace)
110
- return constant if constant.ancestors.include?(Glimmer::UI::CustomWidget)
110
+ return constant if constant&.respond_to?(:ancestors) && constant&.ancestors&.to_a.include?(Glimmer::UI::CustomWidget)
111
111
  constant
112
112
  rescue => e
113
113
  # Glimmer::Config.logger.debug {"#{e.message}\n#{e.backtrace.join("\n")}"}
@@ -158,7 +158,7 @@ module Glimmer
158
158
  args = []
159
159
  end
160
160
  options ||= {}
161
- args = options.delete('swt_style').split(',').map(&:to_sym) if options['swt_style']
161
+ args = options.delete('swt_style').split(',').map(&:to_sym) if options['swt_style']
162
162
  @args = args
163
163
  @swt_style = SWT::SWTProxy[*@args]
164
164
  options ||= {}
@@ -244,7 +244,7 @@ module Glimmer
244
244
 
245
245
  def has_style?(symbol)
246
246
  @args.include?(symbol) # not a very solid implementation. Bring SWT constants eventually
247
- end
247
+ end
248
248
 
249
249
  def async_exec(&block)
250
250
  SWT::DisplayProxy.instance.async_exec(&block)
@@ -273,7 +273,7 @@ module Glimmer
273
273
  end
274
274
  end
275
275
 
276
- alias local_respond_to? respond_to?
276
+ alias local_respond_to? respond_to?
277
277
  def respond_to?(method, *args, &block)
278
278
  super or
279
279
  can_handle_observation_request?(method) or
@@ -7,11 +7,7 @@ module Net
7
7
  # Note: ignore Protocol superclass for now
8
8
  class HTTP
9
9
  def post_form(uri, params)
10
- # pd uri.scheme
11
- # pd uri.host
12
- # pd uri.path
13
- # pd uri.query
14
- # pd params
10
+ # TODO
15
11
  end
16
12
  end
17
13
  end
@@ -0,0 +1,36 @@
1
+ # Copyright (c) 2020 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ class OS
23
+ class << self
24
+ def windows?
25
+ # No Op in Opal
26
+ end
27
+
28
+ def mac?
29
+ # No Op in Opal
30
+ end
31
+
32
+ def linux?
33
+ # No Op in Opal
34
+ end
35
+ end
36
+ end