messagebox 0.0.1.1 → 0.1.0

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Yzg2MDBjNzc5NTc2Y2JiNDhlOGQyYjY3OWZlZjgxMTg4MWM0MDdlOA==
4
+ YTU3ODE3NDA5ZGIwM2MzZDY2N2Y2OWY4NWE4NTk0ZTZhYTMyNmMzNQ==
5
5
  data.tar.gz: !binary |-
6
- Yzc4Mzc3MDZmY2Q5YTkwOTUxMjFhNDNjZDZkODU3NjhmNmMwYTAzNg==
6
+ ZDk0MTIyMWU3ZGJkODk1YzQ3MDA3YWVlMzVkZmFjNDE1OTRhMmYxZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MTFiYTkyNWQ2ZmFmYjY5Y2ZjODgwM2E4NmVlM2EzYmY4MDdlNTNjZTliMTYy
10
- MmU3MDJmNDQ2ZDRiOWYzYTRjMWNmY2NmNzFhMzA2N2YwNGM0M2EzNzEzOGQ4
11
- MmViM2Q2NWYxMzBlMzM3M2RkYzBiOGJlM2VmMDYzNzZjMTFkODU=
9
+ OTQ3NGFlNzZkZWExZjhkMTNkNThkZmJiNjcwYWM0ZWY3ZTE5Y2NhNzVjMjhk
10
+ ODI5YjE0ZjgzZmY0ODJkZDI0ZjA5MTc0NTBmMWUzN2M2NDI2YTQyZGM5ZTk5
11
+ MGI4ZDA0MWMzYmFhMGRkNjA0NDkyNWQ1MjkyM2U4YzFiMzBhZDc=
12
12
  data.tar.gz: !binary |-
13
- NzA4ODFlMWJhZDgyNzMxOTU2NzBhMjA0Y2E2M2I1ZDc2Y2ViN2VlZTBlZDY3
14
- OTcwYTlhZDgyZmZjMjY4NjgzNWEyZmQ0MjE1NzI5NGVmZjgzZmIzYTdiZDRm
15
- YzI4ZDMwYjg3OWM3NTFjMjZmZGIxOWNjNTM4MDRiODNhOTFkNTg=
13
+ MTVjYThmNjAyMjA3YTFhNjI5Yjc2M2QxOWQ2ODNjNTIwMjNkMmE1YzM3NzJj
14
+ YzBkMzQ1ZDY5ODI5MjEwOTI0NTZiNWNkYWNkZDViN2Q0NjY2MjdmZDQ3OTAz
15
+ ZWU2MDhkZWVmYWUzZDY1MTIwNzYwZmFmMGIxZmQxNGYyZmUwMTQ=
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require messagebox
data/README.md CHANGED
@@ -25,23 +25,24 @@ example of `irb` simple code.
25
25
  ```ruby
26
26
  $ irb
27
27
  > require 'messagebox'
28
- > MessageBox.show(
29
- "Example MessageBox",
30
- "This is test message.", 0x40)
28
+ > MessageBox.new("Title", "Example message").show
31
29
  ```
32
30
 
33
- as a result to That show MessageBox of
31
+ Warning MessageBox are
34
32
 
35
- * MessageBox title as a **"Example MessageBox"** (First Parameter)
36
- * MessageBox message as a **"This is test message."** (Second Parameter)
37
-
38
- `0x40` is **MessageBox Style Code.**
39
-
40
- Please show **MSDN Reference** of MessageBox API Function. Parameter as a `uType`
33
+ ```ruby
34
+ $ irb
35
+ > require 'messagebox'
36
+ > MessageBox::Warning.new("Warning", "It's not Good something happen!").show
37
+ ```
41
38
 
42
- currently URL are
39
+ Yes or No selectable MessageBox
43
40
 
44
- * http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx
41
+ ```ruby
42
+ $ irb
43
+ > require 'messagebox'
44
+ > MessageBox::YesNo.new("Yes No message box", "Is this dialog displayed?").show
45
+ ```
45
46
 
46
47
  ## Contributing
47
48
 
@@ -1,13 +1,25 @@
1
- require "messagebox/version"
2
- require 'Win32API'
3
-
4
- class MessageBox
5
- def self.show(title, message, opt_value)
6
- Win32API.new(
7
- "user32",
8
- "MessageBox",
9
- %w(p p p i),
10
- 'i'
11
- ).call(nil, message, title, opt_value)
12
- end
13
- end
1
+ require 'Win32API'
2
+ Dir[File.dirname(__FILE__) + "/messagebox" << '/*.rb'].each do |file|
3
+ require file
4
+ end
5
+
6
+ class MessageBox
7
+ def initialize(title, message, style = 0)
8
+ @title = title
9
+ @message = message
10
+ @style = style
11
+ end
12
+
13
+ def self.show(title, message, style = 0)
14
+ Win32API.new(
15
+ "user32",
16
+ "MessageBox",
17
+ %w(p p p i),
18
+ 'i'
19
+ ).call(nil, message, title, style)
20
+ end
21
+
22
+ def show(message = nil, title = nil)
23
+ MessageBox.show(title || @title, message || @message, @style)
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ class MessageBox
2
+ class Information < MessageBox
3
+ def initialize(title, text)
4
+ super(title, text, 0x40)
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
- module Messagebox
2
- VERSION = "0.0.1.1"
3
- end
1
+ module Messagebox
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,8 @@
1
+ class MessageBox
2
+ class Warning < MessageBox
3
+ def initialize(title, text)
4
+ super(title, text, 0x30)
5
+ end
6
+ end
7
+ class Warn < Warning; end
8
+ end
@@ -0,0 +1,7 @@
1
+ class MessageBox
2
+ class YesNo < MessageBox
3
+ def initialize(title, text)
4
+ super(title, text, 0x24)
5
+ end
6
+ end
7
+ end
@@ -1,23 +1,24 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'messagebox/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "messagebox"
8
- spec.version = Messagebox::VERSION
9
- spec.authors = ["myun2"]
10
- spec.email = ["myun2@nwhite.info"]
11
- spec.description = %q{Rb-Messagebox are show MessageBox dialog for Win32 API.}
12
- spec.summary = %q{Rb-Messagebox are show MessageBox dialog for Win32 API.}
13
- spec.homepage = "https://github.com/myun2/rb-messagebox"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'messagebox/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "messagebox"
8
+ spec.version = Messagebox::VERSION
9
+ spec.authors = ["myun2"]
10
+ spec.email = ["myun2@nwhite.info"]
11
+ spec.description = %q{Rb-Messagebox are show MessageBox dialog for Win32 API.}
12
+ spec.summary = %q{Rb-Messagebox are show MessageBox dialog for Win32 API.}
13
+ spec.homepage = "https://github.com/myun2/rb-messagebox"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1,29 @@
1
+ describe MessageBox do
2
+ context "Class Method .show" do
3
+ subject {
4
+ MessageBox.show(".show", "Class method called.", 0x40)
5
+ }
6
+ it { should eq 1 }
7
+ end
8
+
9
+ context "Plain MessageBox (no style specified)" do
10
+ subject {
11
+ MessageBox.new("Plain MessageBox", "This is plain message box.").show
12
+ }
13
+ it { should eq 1 }
14
+ end
15
+
16
+ describe MessageBox::Warn do
17
+ subject {
18
+ MessageBox::Warn.new("Warning MessageBox", "Warning!").show
19
+ }
20
+ it { should eq 1 }
21
+ end
22
+
23
+ describe MessageBox::YesNo do
24
+ subject {
25
+ MessageBox::YesNo.new("YesNo MessageBox", "This ok?").show
26
+ }
27
+ it { should eq 6 }
28
+ end
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: messagebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - myun2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-30 00:00:00.000000000 Z
11
+ date: 2014-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Rb-Messagebox are show MessageBox dialog for Win32 API.
42
56
  email:
43
57
  - myun2@nwhite.info
@@ -46,13 +60,18 @@ extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
48
62
  - .gitignore
63
+ - .rspec
49
64
  - Gemfile
50
65
  - LICENSE.txt
51
66
  - README.md
52
67
  - Rakefile
53
68
  - lib/messagebox.rb
69
+ - lib/messagebox/information.rb
54
70
  - lib/messagebox/version.rb
71
+ - lib/messagebox/warning.rb
72
+ - lib/messagebox/yesno.rb
55
73
  - messagebox.gemspec
74
+ - spec/messagebox_spec.rb
56
75
  homepage: https://github.com/myun2/rb-messagebox
57
76
  licenses:
58
77
  - MIT
@@ -77,4 +96,5 @@ rubygems_version: 2.0.3
77
96
  signing_key:
78
97
  specification_version: 4
79
98
  summary: Rb-Messagebox are show MessageBox dialog for Win32 API.
80
- test_files: []
99
+ test_files:
100
+ - spec/messagebox_spec.rb