diff --git a/core/boot/option.rb b/core/boot/option.rb index b97d28b..a698fa6 100644 --- a/core/boot/option.rb +++ b/core/boot/option.rb @@ -18,6 +18,10 @@ module Mopt scope.__send__(:define_method, key){ @opts[key.to_sym] } @opts[key.to_sym] end + def respond_to_missing?(key, include_private = false) + @opts.has_key? key.to_sym + end + def parse(argv=ARGV, exec_command: false) unless argv.is_a? OptionParser::Arguable argv.extend(OptionParser::Arguable) end diff --git a/core/lib/lazy.rb b/core/lib/lazy.rb index 457f240..0676aca 100644 --- a/core/lib/lazy.rb +++ b/core/lib/lazy.rb @@ -19,6 +19,10 @@ class IrregularEval def method_missing(method, *args, &block) irregular_eval_object.__send__(method, *args, &block) end end + def respond_to_missing?(method, include_private = false) + irregular_eval_object.respond_to?(method, include_private) + end + class Lazy < IrregularEval def initialize diff --git a/core/lib/retriever/uri.rb b/core/lib/retriever/uri.rb index 3884544..9d9daed 100644 --- a/core/lib/retriever/uri.rb +++ b/core/lib/retriever/uri.rb @@ -104,6 +104,10 @@ class Retriever::URI to_uri.__send__(method, *rest, &block) end + def respond_to_missing?(method, include_private = false) + to_uri.respond_to?(method, include_private) + end + private def generate_uri diff --git a/core/lib/test_unit_extensions.rb b/core/lib/test_unit_extensions.rb index fe635e3..c7d7fa3 100644 --- a/core/lib/test_unit_extensions.rb +++ b/core/lib/test_unit_extensions.rb @@ -34,4 +34,7 @@ module Mopt scope.__send__(:define_method, key){ @opts[key.to_sym] } @opts[key.to_sym] end + def respond_to_missing?(key, include_private = false) + @opts.has_key? key.to_sym + end end diff --git a/core/mui/cairo_timeline.rb b/core/mui/cairo_timeline.rb index cdaa16c..03dda7f 100644 --- a/core/mui/cairo_timeline.rb +++ b/core/mui/cairo_timeline.rb @@ -127,6 +127,10 @@ class Gtk::TimeLine def method_missing(method_name, *args, &proc) @tl.__send__(method_name, *args, &proc) end + def respond_to_missing?(method_name, include_private = false) + @tl.respond_to?(method_name, include_private) + end + protected # _message_ をTLに追加する diff --git a/core/mui/gtk_form_dsl.rb b/core/mui/gtk_form_dsl.rb index a1cc475..5afc3b7 100644 --- a/core/mui/gtk_form_dsl.rb +++ b/core/mui/gtk_form_dsl.rb @@ -351,6 +351,10 @@ module Gtk::FormDSL @plugin.__send__(*args, &block) end + def respond_to_missing?(symbol, include_private = false) + @plugin.respond_to?(symbol, include_private) + end + private def about_converter diff --git a/core/mui/gtk_form_dsl_select.rb b/core/mui/gtk_form_dsl_select.rb index 7785f74..874d325 100644 --- a/core/mui/gtk_form_dsl_select.rb +++ b/core/mui/gtk_form_dsl_select.rb @@ -51,6 +51,10 @@ class Gtk::FormDSL::Select @parent_dslobj.method_missing(*args, &block) end + def respond_to_missing?(symbol, include_private = false) + @parent_dslobj.respond_to?(symbol, include_private) + end + private def build_box(config_key) diff --git a/core/plugin/achievement/achievement.rb b/core/plugin/achievement/achievement.rb index 4f90f1d..c5c92b3 100644 --- a/core/plugin/achievement/achievement.rb +++ b/core/plugin/achievement/achievement.rb @@ -65,6 +65,10 @@ class Plugin::Achievement::Achievement result end + def respond_to_missing?(method, include_private = false) + plugin.respond_to?(method, include_private) + end + private def _force_take! diff --git a/core/plugin/activity/activity.rb b/core/plugin/activity/activity.rb index 4e90aa7..0f387e4 100644 --- a/core/plugin/activity/activity.rb +++ b/core/plugin/activity/activity.rb @@ -55,6 +55,10 @@ Plugin.create(:activity) do def method_missing(*args, &block) @plugin.__send__(*args, &block) end + + def respond_to_missing?(symbol, include_private = false) + @plugin.respond_to?(symbol, include_private) + end end BOOT_TIME = Time.new.freeze diff --git a/core/plugin/change_account/world_generator/controller.rb b/core/plugin/change_account/world_generator/controller.rb index a72c6ff..98d3425 100644 --- a/core/plugin/change_account/world_generator/controller.rb +++ b/core/plugin/change_account/world_generator/controller.rb @@ -36,4 +36,8 @@ class Plugin::ChangeAccount::WorldGenerator::Controller @plugin.__send__(*args, &block) end + def respond_to_missing?(symbol, include_private = false) + @plugin.respond_to?(symbol, include_private) + end + end diff --git a/core/plugin/extract/extract.rb b/core/plugin/extract/extract.rb index 788bb51..ddfe826 100644 --- a/core/plugin/extract/extract.rb +++ b/core/plugin/extract/extract.rb @@ -52,6 +52,10 @@ module Plugin::Extract else super end end + def respond_to_missing?(method_name, include_private = false) + @operators.any?{ |_| _.slug == method_name } + end + def call(*args) @condition.(*args, message: @message) end end diff --git a/core/plugin/gui/widget.rb b/core/plugin/gui/widget.rb index dfc32c1..468ab8b 100644 --- a/core/plugin/gui/widget.rb +++ b/core/plugin/gui/widget.rb @@ -97,4 +97,8 @@ module Plugin::GUI::Widget else super end end + def respond_to_missing?(symbol, include_private = false) + defined?(@delegate) and @delegate and @delegate.respond_to?(symbol, include_private) + end + end diff --git a/core/plugin/settings/phantom.rb b/core/plugin/settings/phantom.rb index a67a8cb..10f6639 100644 --- a/core/plugin/settings/phantom.rb +++ b/core/plugin/settings/phantom.rb @@ -35,10 +35,23 @@ module Plugin::Settings end end + def respond_to_missing?(name, include_private = false) + case name.to_sym + when *Gtk::FormDSL.instance_methods + MOCK.respond_to?(name, include_private) + else + Plugin.instance(@plugin_slug).respond_to?(name, include_private) + end + end + class Mock def method_missing(name, *rest, **kwrest, &block) MOCK end + + def respond_to_missing?(name, include_private = false) + MOCK.respond_to?(name, include_private) + end end MOCK = Mock.new diff --git a/core/plugin/twitter/model/world.rb b/core/plugin/twitter/model/world.rb index 368111b..7d6da3b 100644 --- a/core/plugin/twitter/model/world.rb +++ b/core/plugin/twitter/model/world.rb @@ -178,6 +178,10 @@ module Plugin::Twitter result end + def respond_to_missing?(method_name, include_private = false) + twitter.respond_to?(method_name, include_private) + end + # :nodoc: # 内部で利用するために用意されています。 # ツイートを投稿したい場合は、