qml 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31d0f1bbab5b1fa3d4b602baa55fc7df071f65a4
4
- data.tar.gz: 4ba0b8cecc4f63b26f2284e56f132d19bd176c2b
3
+ metadata.gz: 531c290e09cd315f45f4cfb07d55d9e16e16fef6
4
+ data.tar.gz: 5452466222e562568f69b30771a6adc51e00e892
5
5
  SHA512:
6
- metadata.gz: 29d4ae1d6ff4f3218cea47dd8d40b0b02441beb1a82f678138618c654dcc9ac0bf71f5cac6c11717ae13a6dc6d43cc1fab7fce3d061b01efe6761a308cba8c10
7
- data.tar.gz: cb4a008e7083492d416a09d472668f67dc751db63ffd7d31d97d72726e9ec21610d4562e638c410548aaddedda3a1f2bc533bb2b0e7e021f4b9d77ec01e23ff1
6
+ metadata.gz: 297b2394051b19603dda694d5c4890a39cbeaf1c2123d9365586bc2de30c24d179c76f71c491b4671701e3f9ab6d690de87d0760bb958196874cb560e6e51aa1
7
+ data.tar.gz: c6a5ef840aa64784c9eb0f4af85261c5ff92a021f1f4eb3a81ddef60f488c6873cd8a97fa3297d317dbd29bcbb3192ff16ab6eefda22ff7c7d6ebb4f4a0ce34d
data/.travis.yml CHANGED
@@ -2,12 +2,13 @@ language: ruby
2
2
  rvm:
3
3
  - 2.1.2
4
4
  - 2.0.0
5
+ - 1.9.3
5
6
  before_install:
6
7
  - sudo apt-add-repository -y ppa:beineri/opt-qt521
7
8
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
8
9
  - sudo apt-get update
9
- - sudo apt-get install -y g++-4.8 libffi-dev qt52base qt52declarative qt52declarative
10
- - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
10
+ - sudo apt-get install -y g++-4.7 libffi-dev qt52base qt52declarative
11
+ - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 90
11
12
  before_script:
12
13
  - source /opt/qt52/bin/qt52-env.sh
13
14
  - cd ext/qml
data/README.md CHANGED
@@ -7,6 +7,13 @@
7
7
  ruby-qml is a QML / Qt Quick wrapper for Ruby.
8
8
  It provides bindings between QML and Ruby and enables you to use Qt Quick-based GUI from Ruby.
9
9
 
10
+ ## What you can do with ruby-qml
11
+
12
+ * Develop desktop GUI applications only with Ruby and QML
13
+ * Easily combine codes written in C++ and Qt with your Ruby code
14
+
15
+ ## Documentation and Examples
16
+
10
17
  * [Documentation](http://rubydoc.info/github/seanchas116/ruby-qml/master/frames)
11
18
  * [Examples](https://github.com/seanchas116/ruby-qml/tree/master/examples)
12
19
 
@@ -18,7 +25,7 @@ It provides bindings between QML and Ruby and enables you to use Qt Quick-based
18
25
 
19
26
  ## Installation
20
27
 
21
- ruby-qml currently requires **Ruby 2.0 or later**.
28
+ ruby-qml requires **Ruby 1.9 or later**.
22
29
 
23
30
  ### OS X with Homebrew
24
31
 
@@ -29,7 +36,7 @@ Run the following commands to install ruby-qml on OS X with Homebrew:
29
36
  $ brew install qt5
30
37
  $ gem install qml -- --with-libffi-dir=$(brew --prefix libffi) --with-qt-dir=$(brew --prefix qt5)
31
38
 
32
- ### General
39
+ ### General (OSX and Linux)
33
40
 
34
41
  #### Requirements
35
42
 
@@ -56,7 +63,7 @@ For example:
56
63
 
57
64
  $ bundle config build.qml --with-libffi-dir=$(brew --prefix libffi) --with-qt-dir=$(brew --prefix qt5)
58
65
 
59
- The configuration will be saved in `~/.bundle/config`
66
+ The configuration will be saved in `~/.bundle/config`.
60
67
 
61
68
  ## Usage
62
69
 
@@ -410,5 +417,6 @@ Contributions are welcome. When you are contributing to ruby-qml:
410
417
  1. Fork it ( http://github.com/seanchas116/ruby-qml/fork )
411
418
  2. Create your feature branch (`git checkout -b my-new-feature`)
412
419
  3. Commit your changes (`git commit -am 'Add some feature'`)
413
- 4. Push to the branch (`git push origin my-new-feature`)
414
- 5. Create new Pull Request
420
+ 4. Write some tests if possible
421
+ 5. Push to the branch (`git push origin my-new-feature`)
422
+ 6. Create new Pull Request
data/changes.md CHANGED
@@ -1,4 +1,8 @@
1
- # 0.0.2 (2014-07-21)
1
+ ## 0.0.3 (2014-07-22)
2
+
3
+ * Support Ruby 1.9.3
4
+
5
+ ## 0.0.2 (2014-07-21)
2
6
 
3
7
  * Improve list models
4
8
 
@@ -12,6 +16,6 @@
12
16
 
13
17
  * Improve README
14
18
 
15
- # 0.0.1 (2014-07-19)
19
+ ## 0.0.1 (2014-07-19)
16
20
 
17
21
  * Initial release
data/ext/qml/extconf.rb CHANGED
@@ -11,6 +11,7 @@ class Configurator
11
11
  find_dependencies
12
12
  @cppflags = []
13
13
  @ldflags = []
14
+ @debug_enabled = enable_config('debug')
14
15
  end
15
16
 
16
17
  def find_dependencies
@@ -35,9 +36,10 @@ class Configurator
35
36
 
36
37
  def build_plugins
37
38
  puts "building plugins..."
39
+ qmake_opts = @debug_enabled ? 'CONFIG+=debug' : ''
38
40
  Pathname(__FILE__).+("../plugins").children.select(&:directory?).each do |dir|
39
41
  Dir.chdir(dir) do
40
- system("#{@qmake}") && system('make') or abort "failed to build plugin: #{dir.basename}"
42
+ system("#{@qmake} #{qmake_opts}") && system('make clean') && system('make') or abort "failed to build plugin: #{dir.basename}"
41
43
  end
42
44
  end
43
45
  end
@@ -64,8 +66,13 @@ class Configurator
64
66
  abort "header not found: #{h}" unless have_header(h)
65
67
  end
66
68
 
69
+ unless have_func('rb_thread_call_with_gvl') && have_func('rb_thread_call_without_gvl')
70
+ abort "rb_thread_call_with_gvl and rb_thread_call_without_gvl not found"
71
+ end
72
+ $CPPFLAGS += " -DHAVE_RUBY_THREAD_H" if have_header('ruby/thread.h')
73
+
67
74
  $CPPFLAGS += " -std=c++11 -Wall -Wextra -pipe"
68
- if enable_config('debug')
75
+ if @debug_enabled
69
76
  $CPPFLAGS += " -O0 -ggdb3"
70
77
  else
71
78
  $CPPFLAGS += " -O3"
data/ext/qml/rubyvalue.h CHANGED
@@ -140,7 +140,7 @@ struct Conversion<T, typename std::enable_if<std::is_floating_point<T>::value>::
140
140
  if (type == T_FIXNUM || type == T_BIGNUM) {
141
141
  return double(NUM2LL(x));
142
142
  } else {
143
- return rb_float_value(x);
143
+ return RFLOAT_VALUE(VALUE(x));
144
144
  }
145
145
  });
146
146
  }
data/ext/qml/util.cpp CHANGED
@@ -1,11 +1,19 @@
1
1
  #include "util.h"
2
2
  #include "rubyvalue.h"
3
3
  #include <QString>
4
- #include <ruby/thread.h>
5
4
  #include <string>
6
5
  #include <memory>
7
6
  #include <cxxabi.h>
8
7
 
8
+ #ifdef HAVE_RUBY_THREAD_H
9
+ #include <ruby/thread.h>
10
+ #else
11
+ extern "C" {
12
+ void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
13
+ void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1, rb_unblock_function_t *ubf, void *data2);
14
+ }
15
+ #endif
16
+
9
17
  namespace RubyQml {
10
18
 
11
19
  void protect(const std::function<void ()> &doAction)
@@ -94,9 +102,9 @@ void changeGvl(const std::function<void ()> &doAction, bool gvl)
94
102
  };
95
103
  void *result;
96
104
  if (gvl) {
97
- result = rb_thread_call_with_gvl(f, actionPtr );
105
+ result = rb_thread_call_with_gvl(f, actionPtr);
98
106
  } else {
99
- result = rb_thread_call_without_gvl(f, actionPtr , RUBY_UBF_IO, nullptr);
107
+ result = rb_thread_call_without_gvl(f, actionPtr, RUBY_UBF_IO, nullptr);
100
108
  }
101
109
  std::unique_ptr<std::exception_ptr> exc(static_cast<std::exception_ptr *>(result));
102
110
  if (exc && *exc) {
data/lib/qml.rb CHANGED
@@ -27,11 +27,13 @@ module QML
27
27
  end
28
28
 
29
29
  # Initializes ruby-qml.
30
- # @param [Boolean] offscreen set this to true to run application offscreen (without GUI)
31
- def init(offscreen: false)
30
+ # @param [Hash] opts
31
+ # @option opts [Boolean] :offscreen (false) set this to true to run application offscreen (without GUI)
32
+ def init(opts = {})
33
+ opts = {offscreen: false}.merge opts
32
34
  fail AlreadyInitializedError, "ruby-qml already initialized" if initialized?
33
35
  argv = [$PROGRAM_NAME]
34
- argv += %w{-platform offscreen} if offscreen
36
+ argv += %w{-platform offscreen} if opts[:offscreen]
35
37
  Kernel.init(argv)
36
38
  application.events_processed.each do
37
39
  Dispatcher.instance.run_tasks
data/lib/qml/access.rb CHANGED
@@ -38,10 +38,15 @@ module QML
38
38
  module ClassMethods
39
39
 
40
40
  # Registers the class as a QML type.
41
- # @param under [String|nil] the namespece which encapsulates the exported QML type. If not specified, automatically inferred from the module nesting of the class.
42
- # @param version [String|nil] the version of the type. Defaults to VERSION constant of the encapsulating module / class of the class.
43
- # @param name [String|nil] the name of the type. Defaults to the name of the class.
44
- def register_to_qml(under: nil, version: nil, name: nil)
41
+ # @param opts [Hash]
42
+ # @option opts [String] :under the namespece which encapsulates the exported QML type. If not specified, automatically inferred from the module nesting of the class.
43
+ # @option opts [String] :version the version of the type. Defaults to VERSION constant of the encapsulating module / class of the class.
44
+ # @option opts [String] :name the name of the type. Defaults to the name of the class.
45
+ def register_to_qml(opts = {})
46
+ under = opts[:under]
47
+ version = opts[:version]
48
+ name = opts[:name]
49
+
45
50
  if !under || !version || !name
46
51
  path = self.name.split('::')
47
52
  end
@@ -56,9 +56,12 @@ module QML
56
56
  end
57
57
 
58
58
  # Loads a QML file. The loaded component can be accessed by {#root_component}
59
+ # @param [Hash] opts
60
+ # @option opts [String] :data
61
+ # @option opts [String] :path
59
62
  # @see Component
60
- def load(data: nil, path: nil)
61
- @root_component = Component.new(data: data, path: path)
63
+ def load(opts)
64
+ @root_component = Component.new(data: opts[:data], path: opts[:path])
62
65
  @root = @root_component.create
63
66
  end
64
67
 
@@ -5,9 +5,7 @@ require 'qml/name_helper'
5
5
 
6
6
  module QML
7
7
 
8
- class QtProperty
9
- prepend Reactive::Bindable
10
-
8
+ class QtPropertyBase
11
9
  attr_reader :changed
12
10
 
13
11
  def initialize(metaobj, objptr, name)
@@ -27,9 +25,13 @@ module QML
27
25
  end
28
26
  end
29
27
 
28
+ class QtProperty < QtPropertyBase
29
+ include Reactive::Bindable
30
+ end
31
+
30
32
  class QtSignal < Reactive::Signal
31
33
  def initialize(metaobj, objptr, name)
32
- super(variadic: true)
34
+ super([], variadic: true)
33
35
  @objptr = objptr
34
36
  @metaobj = metaobj
35
37
  @name = name
@@ -103,7 +105,7 @@ module QML
103
105
 
104
106
  def define_property(name)
105
107
  metaobj = @metaobj
106
- @klass.__send__ :property, name, factory: proc { |obj|
108
+ @klass.__send__ :property, name, nil, factory: proc { |obj|
107
109
  QtProperty.new(@metaobj, obj.pointer, name)
108
110
  }
109
111
  underscore = NameHelper.to_underscore(name)
data/lib/qml/component.rb CHANGED
@@ -15,11 +15,15 @@ module QML
15
15
  attr_reader :data, :path, :context
16
16
 
17
17
  # Creates an component. Either data or path must be specified.
18
- # @param context [QML::Context|nil] The context that the created objects will depend on (default to the root context of the application engine)
19
- # @param data [String] The QML file data
20
- # @param path [#to_s] The QML file path
18
+ # @param opts [Hash]
19
+ # @option opts [QML::Context] :context the context that the created objects will depend on (default to the root context of the application engine).
20
+ # @option opts [String] :data the QML file data.
21
+ # @option opts [#to_s] :path the QML file path.
21
22
  # @return QML::Component
22
- def self.new(context: nil, data: nil, path: nil)
23
+ def self.new(opts)
24
+ context = opts[:context]
25
+ data = opts[:data]
26
+ path = opts[:path]
23
27
  context ||= Engine.instance.context
24
28
  Plugins.core.createComponent(Engine.instance).instance_eval do
25
29
  @data = data
@@ -73,7 +73,7 @@ module QML
73
73
  # @see #inserting
74
74
  # @see #removing
75
75
  def moving(range, destination)
76
- return if range.size == 0
76
+ return if range.count == 0
77
77
 
78
78
  @qt_models.each do |qt_model|
79
79
  qt_model.begin_move(range.min, range.max, destination)
@@ -98,7 +98,7 @@ module QML
98
98
  # @see #removing
99
99
  # @see #moving
100
100
  def inserting(range, &block)
101
- return if range.size == 0
101
+ return if range.count == 0
102
102
 
103
103
  @qt_models.each do |qt_model|
104
104
  qt_model.begin_insert(range.min, range.max)
@@ -119,7 +119,7 @@ module QML
119
119
  # @see #inserting
120
120
  # @see #moving
121
121
  def removing(range, &block)
122
- return if range.size == 0
122
+ return if range.count == 0
123
123
 
124
124
  @qt_models.each do |qt_model|
125
125
  qt_model.begin_remove(range.min, range.max)
@@ -125,6 +125,8 @@ module QML
125
125
  # The signal will be variadic if args == nil.
126
126
  # @param name [#to_sym] The signal name
127
127
  # @param params [Array<#to_sym>, nil] The signal parameter names
128
+ # @param opts [Hash]
129
+ # @option opts [Proc] :factory (nil)
128
130
  # @return [Symbol] The signal name
129
131
  # @example
130
132
  # class Button
@@ -146,19 +148,21 @@ module QML
146
148
  # color_button = ColorButton.new
147
149
  # color_button.pressed.connect { |pos, color| "#{color} button pressed at #{pos}" }
148
150
  # color_button.press([10, 20], 'red')
149
- def signal(name, params, factory: nil)
151
+ def signal(name, params, opts = {})
150
152
  name.to_sym.tap do |name|
151
153
  params = params.map(&:to_sym)
152
- add_signal(UnboundSignal.new(name, params, false, self, factory))
154
+ add_signal(UnboundSignal.new(name, params, false, self, opts[:factory]))
153
155
  end
154
156
  end
155
157
 
156
158
  # Defines a variadic signal.
157
159
  # Variadic signals do not restrict the number of arguments.
160
+ # @param opts [Hash]
161
+ # @option opts [Proc] :factory (nil)
158
162
  # @see #signal
159
- def variadic_signal(name, factory: nil)
163
+ def variadic_signal(name, opts = {})
160
164
  name.to_sym.tap do |name|
161
- add_signal(UnboundSignal.new(name, nil, true, self, factory))
165
+ add_signal(UnboundSignal.new(name, nil, true, self, opts[:factory]))
162
166
  end
163
167
  end
164
168
 
@@ -172,6 +176,8 @@ module QML
172
176
  # Defines a property for the class.
173
177
  # @param name [#to_sym] The name of the property
174
178
  # @param init_value The initial value (optional)
179
+ # @param opts [Hash]
180
+ # @option opts [Proc] :factory (nil)
175
181
  # @yield The initial property binding (optional)
176
182
  # @return [Symbol] The name
177
183
  # @example
@@ -190,9 +196,9 @@ module QML
190
196
  # property(:name) { 'piyopiyo' }
191
197
  # end
192
198
  # Bar.new.name #=> 'piyopiyo'
193
- def property(name, init_value = nil, factory: nil, &init_binding)
199
+ def property(name, init_value = nil, opts = {}, &init_binding)
194
200
  name = name.to_sym
195
- add_property(UnboundProperty.new(name, init_value, init_binding, self, factory))
201
+ add_property(UnboundProperty.new(name, init_value, init_binding, self, opts[:factory]))
196
202
  name
197
203
  end
198
204
 
@@ -259,10 +265,10 @@ module QML
259
265
  add_signal(property.notifier_signal)
260
266
  end
261
267
 
262
- def initial_connections_hash(include_super: true)
268
+ def initial_connections_hash(include_super = true)
263
269
  if include_super && superclass.include?(Object)
264
270
  superclass.send(:initial_connections_hash).dup.tap do |hash|
265
- initial_connections_hash(include_super: false).each do |key, blocks|
271
+ initial_connections_hash(false).each do |key, blocks|
266
272
  hash[key] ||= []
267
273
  hash[key] += blocks
268
274
  end
@@ -20,9 +20,12 @@ module QML
20
20
  # Initializes the Signal.
21
21
  # The signal will be variadic if an empty array is given.
22
22
  # @param [Array<#to_sym>, Array<()>] params The parameter names.
23
- def initialize(*params, variadic: false)
23
+ # @param [Hash] opts
24
+ # @option opts [Boolean] (false) :variadic
25
+ def initialize(params, opts = {})
26
+ opts = {variadic: false}.merge opts
24
27
  @listeners = []
25
- if variadic
28
+ if opts[:variadic]
26
29
  @params = nil
27
30
  @arity = -1
28
31
  else
@@ -5,7 +5,7 @@ module QML
5
5
  module Signals
6
6
  class MapSignal < ChainedSignal
7
7
  def initialize(source, func)
8
- super(:mapped)
8
+ super([:mapped])
9
9
  @source = source
10
10
  @func = func
11
11
  end
@@ -6,7 +6,7 @@ module QML
6
6
  class MergeSignal < ChainedSignal
7
7
  def initialize(sources)
8
8
  param_count = sources.map(&:arity).max
9
- super(*param_count.times.map { |i| :"arg#{i}" })
9
+ super(param_count.times.map { |i| :"arg#{i}" })
10
10
  @sources = sources
11
11
  end
12
12
 
@@ -5,7 +5,7 @@ module QML
5
5
  module Signals
6
6
  class SelectSignal < ChainedSignal
7
7
  def initialize(source, pred)
8
- super(*source.parameters.map(&:last))
8
+ super(source.parameters.map(&:last))
9
9
  @source = source
10
10
  @pred = pred
11
11
  end
@@ -10,7 +10,7 @@ module QML
10
10
  attr_reader :changed
11
11
 
12
12
  def initialize
13
- @changed = Signal.new(:new_value)
13
+ @changed = Signal.new([:new_value])
14
14
  end
15
15
  end
16
16
  end
@@ -41,9 +41,9 @@ module QML
41
41
  def bind(obj)
42
42
  return @factory.call(obj, self) if @factory
43
43
  if @variadic
44
- Signal.new(variadic: true)
44
+ Signal.new([], variadic: true)
45
45
  else
46
- Signal.new(*@params)
46
+ Signal.new(@params)
47
47
  end
48
48
  end
49
49
  end
data/lib/qml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module QML
2
- VERSION = "0.0.2"
2
+ VERSION = '0.0.3'
3
3
  end
data/qml.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
  spec.extensions = ["ext/qml/extconf.rb"]
21
21
 
22
- spec.required_ruby_version = '~> 2.0'
22
+ spec.required_ruby_version = '>= 1.9.3'
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.5"
25
25
  spec.add_development_dependency "rake", "~> 10.3"
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  def convert(value)
@@ -181,14 +181,14 @@ describe QML::Reactive::Object do
181
181
  context 'when include_super is false' do
182
182
  it 'returns all signal definitions of the class' do
183
183
  signals = ToggleButton.instance_signals(false)
184
- expect(signals).to match_array %i{pressed toggled name_changed info_changed}
184
+ expect(signals).to match_array %w{pressed toggled name_changed info_changed}.map(&:to_sym)
185
185
  end
186
186
  end
187
187
 
188
188
  context 'when include_super is not specified' do
189
189
  it 'returns all signal definitions of the class and its superclasses' do
190
190
  signals = ToggleButton.instance_signals
191
- expect(signals).to match_array %i{pressed message toggled name_changed id_changed info_changed name_double_changed clicked title_changed}
191
+ expect(signals).to match_array %w{pressed message toggled name_changed id_changed info_changed name_double_changed clicked title_changed}.map(&:to_sym)
192
192
  end
193
193
  end
194
194
  end
@@ -197,14 +197,14 @@ describe QML::Reactive::Object do
197
197
  context 'when include_super is false' do
198
198
  it 'returns all property definitions of the class' do
199
199
  properties = ToggleButton.instance_properties(false)
200
- expect(properties).to match_array %i{name info}
200
+ expect(properties).to match_array %w{name info}.map(&:to_sym)
201
201
  end
202
202
  end
203
203
 
204
204
  context 'when include_super is not specified' do
205
205
  it 'returns all property definitions of the class and its superclasses' do
206
206
  properties = ToggleButton.instance_properties
207
- expect(properties).to match_array %i{name id info name_double title}
207
+ expect(properties).to match_array %w{name id info name_double title}.map(&:to_sym)
208
208
  end
209
209
  end
210
210
  end
@@ -239,13 +239,13 @@ describe QML::Reactive::Object do
239
239
 
240
240
  describe '#signals' do
241
241
  it 'returns signal names for object' do
242
- expect(toggle_button.signals).to match_array %i{pressed message toggled id_changed name_changed info_changed name_double_changed clicked title_changed}
242
+ expect(toggle_button.signals).to match_array %w{pressed message toggled id_changed name_changed info_changed name_double_changed clicked title_changed}.map(&:to_sym)
243
243
  end
244
244
  end
245
245
 
246
246
  describe '#properties' do
247
247
  it 'return property names for object' do
248
- expect(toggle_button.properties).to match_array %i{name id info name_double title}
248
+ expect(toggle_button.properties).to match_array %w{name id info name_double title}.map(&:to_sym)
249
249
  end
250
250
  end
251
251
 
@@ -25,8 +25,8 @@ describe QML::Reactive::Property do
25
25
  describe '#value, #value=' do
26
26
  it 'sets and gets the contained value' do
27
27
  property = QML::Reactive::Property.new
28
- property.value = '(´・_・`)'
29
- expect(property.value).to eq('(´・_・`)')
28
+ property.value = 'hogehoge'
29
+ expect(property.value).to eq('hogehoge')
30
30
  end
31
31
  end
32
32
  end
@@ -3,8 +3,8 @@ require 'spec_helper'
3
3
  describe QML::Reactive::Signal do
4
4
 
5
5
  before do
6
- @signal = QML::Reactive::Signal.new(:foo, :bar)
7
- @variadic_signal = QML::Reactive::Signal.new(variadic: true)
6
+ @signal = QML::Reactive::Signal.new([:foo, :bar])
7
+ @variadic_signal = QML::Reactive::Signal.new([], variadic: true)
8
8
  end
9
9
 
10
10
  describe 'connection' do
@@ -65,7 +65,7 @@ describe QML::Reactive::Signal do
65
65
  end
66
66
 
67
67
  it 'disconnects the whole chained connections if possible' do
68
- signal = QML::Reactive::Signal.new :arg
68
+ signal = QML::Reactive::Signal.new [:arg]
69
69
  mapped = signal.map { |arg| arg * 2 }
70
70
 
71
71
  connection = mapped.connect {}
@@ -175,8 +175,8 @@ describe QML::Reactive::Signal do
175
175
  it 'merges multiple signals' do
176
176
  received = []
177
177
 
178
- signal = QML::Reactive::Signal.new :foo
179
- signal2 = QML::Reactive::Signal.new :foo
178
+ signal = QML::Reactive::Signal.new [:foo]
179
+ signal2 = QML::Reactive::Signal.new [:foo]
180
180
  signal.merge(signal2).connect { |foo| received << foo }
181
181
 
182
182
  signal.emit(:one)
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe QML::Reactive::SignalSpy do
4
4
 
5
5
  it 'records signal emittion' do
6
- signal = QML::Reactive::Signal.new(:arg1, :arg2)
6
+ signal = QML::Reactive::Signal.new([:arg1, :arg2])
7
7
  spy = QML::Reactive::SignalSpy.new(signal)
8
8
  signal.emit(10, 20)
9
9
  signal.emit('foo', 'bar')
@@ -16,7 +16,7 @@ describe QML::Reactive::Signal do
16
16
 
17
17
  describe '#spy' do
18
18
  it 'returns a SignalSpy for the signal' do
19
- signal = QML::Reactive::Signal.new(:arg1, :arg2)
19
+ signal = QML::Reactive::Signal.new([:arg1, :arg2])
20
20
  spy = signal.spy
21
21
  signal.emit(10, 20)
22
22
  signal.emit('foo', 'bar')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryohei Ikegami
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-21 00:00:00.000000000 Z
11
+ date: 2014-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -319,9 +319,9 @@ require_paths:
319
319
  - lib
320
320
  required_ruby_version: !ruby/object:Gem::Requirement
321
321
  requirements:
322
- - - "~>"
322
+ - - ">="
323
323
  - !ruby/object:Gem::Version
324
- version: '2.0'
324
+ version: 1.9.3
325
325
  required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  requirements:
327
327
  - - ">="