lib/messagebox.rb in messagebox-0.0.1.1 vs lib/messagebox.rb in messagebox-0.1.0

- old
+ new

@@ -1,13 +1,25 @@ -require "messagebox/version" -require 'Win32API' - -class MessageBox - def self.show(title, message, opt_value) - Win32API.new( - "user32", - "MessageBox", - %w(p p p i), - 'i' - ).call(nil, message, title, opt_value) - end -end +require 'Win32API' +Dir[File.dirname(__FILE__) + "/messagebox" << '/*.rb'].each do |file| + require file +end + +class MessageBox + def initialize(title, message, style = 0) + @title = title + @message = message + @style = style + end + + def self.show(title, message, style = 0) + Win32API.new( + "user32", + "MessageBox", + %w(p p p i), + 'i' + ).call(nil, message, title, style) + end + + def show(message = nil, title = nil) + MessageBox.show(title || @title, message || @message, @style) + end +end