Module: FRuby::Utils
Instance Method Summary collapse
- #has_instance_method?(obj, method_name) ⇒ Boolean
- #multiple_all?(*args, &block) ⇒ Boolean
- #multiple_each(*args, &block) ⇒ Object
- #rand_condition_method_name(prefix, size = 8) ⇒ Object
Instance Method Details
#has_instance_method?(obj, method_name) ⇒ Boolean
8 9 10 |
# File 'lib/utils.rb', line 8 def has_instance_method?(obj, method_name) obj.instance_methods.include? method_name.to_s end |
#multiple_all?(*args, &block) ⇒ Boolean
18 19 20 21 22 23 |
# File 'lib/utils.rb', line 18 def multiple_all?(*args, &block) multiple_each(*args) do |*each_args| return false unless block.call(*each_args) end true end |
#multiple_each(*args, &block) ⇒ Object
12 13 14 15 16 |
# File 'lib/utils.rb', line 12 def multiple_each(*args, &block) args.first.size.times do |index| block.call(args.map { |arg| arg[index] }) end end |