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 +4 -4
- data/.travis.yml +3 -2
- data/README.md +13 -5
- data/changes.md +6 -2
- data/ext/qml/extconf.rb +9 -2
- data/ext/qml/rubyvalue.h +1 -1
- data/ext/qml/util.cpp +11 -3
- data/lib/qml.rb +5 -3
- data/lib/qml/access.rb +9 -4
- data/lib/qml/application.rb +5 -2
- data/lib/qml/class_builder.rb +7 -5
- data/lib/qml/component.rb +8 -4
- data/lib/qml/data/list_model.rb +3 -3
- data/lib/qml/reactive/object.rb +14 -8
- data/lib/qml/reactive/signal.rb +5 -2
- data/lib/qml/reactive/signals/map_signal.rb +1 -1
- data/lib/qml/reactive/signals/merge_signal.rb +1 -1
- data/lib/qml/reactive/signals/select_signal.rb +1 -1
- data/lib/qml/reactive/simple_property.rb +1 -1
- data/lib/qml/reactive/unbound_signal.rb +2 -2
- data/lib/qml/version.rb +1 -1
- data/qml.gemspec +1 -1
- data/spec/qml/conversion_spec.rb +1 -0
- data/spec/qml/reactive/object_spec.rb +6 -6
- data/spec/qml/reactive/property_spec.rb +2 -2
- data/spec/qml/reactive/signal_spec.rb +5 -5
- data/spec/qml/reactive/signal_spy_spec.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 531c290e09cd315f45f4cfb07d55d9e16e16fef6
|
4
|
+
data.tar.gz: 5452466222e562568f69b30771a6adc51e00e892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
10
|
-
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.
|
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
|
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.
|
414
|
-
5.
|
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
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
|
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
|
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
|
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 [
|
31
|
-
|
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
|
42
|
-
# @
|
43
|
-
# @
|
44
|
-
|
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
|
data/lib/qml/application.rb
CHANGED
@@ -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(
|
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
|
|
data/lib/qml/class_builder.rb
CHANGED
@@ -5,9 +5,7 @@ require 'qml/name_helper'
|
|
5
5
|
|
6
6
|
module QML
|
7
7
|
|
8
|
-
class
|
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
|
19
|
-
# @
|
20
|
-
# @
|
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(
|
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
|
data/lib/qml/data/list_model.rb
CHANGED
@@ -73,7 +73,7 @@ module QML
|
|
73
73
|
# @see #inserting
|
74
74
|
# @see #removing
|
75
75
|
def moving(range, destination)
|
76
|
-
return if range.
|
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.
|
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.
|
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)
|
data/lib/qml/reactive/object.rb
CHANGED
@@ -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,
|
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,
|
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,
|
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
|
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(
|
271
|
+
initial_connections_hash(false).each do |key, blocks|
|
266
272
|
hash[key] ||= []
|
267
273
|
hash[key] += blocks
|
268
274
|
end
|
data/lib/qml/reactive/signal.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/qml/version.rb
CHANGED
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 = '
|
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"
|
data/spec/qml/conversion_spec.rb
CHANGED
@@ -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 %
|
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 %
|
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 %
|
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 %
|
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 %
|
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 %
|
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.
|
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-
|
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:
|
324
|
+
version: 1.9.3
|
325
325
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
326
326
|
requirements:
|
327
327
|
- - ">="
|