module ActiveMocker::MockCreator::SafeMethods
Constants
- BASE
Public Instance Methods
safe_method?(type, name)
click to toggle source
# File lib/active_mocker/mock_creator/safe_methods.rb, line 7 def safe_method?(type, name) plural_type = (type.to_s + "s").to_sym all_methods_safe = all_methods_safe?(type, name) return true if all_methods_safe return true if safe_methods[plural_type].include?(name) false end
Private Instance Methods
all_methods_safe?(type, name)
click to toggle source
# File lib/active_mocker/mock_creator/safe_methods.rb, line 29 def all_methods_safe?(type, name) plural_type = (type.to_s + "s").to_sym all_methods_safe = safe_methods.fetch(:all_methods_safe) if all_methods_safe.is_a?(Hash) !all_methods_safe.fetch(plural_type).include?(name) else all_methods_safe end end
safe_methods()
click to toggle source
# File lib/active_mocker/mock_creator/safe_methods.rb, line 17 def safe_methods @safe_methods ||= class_introspector.parsed_source.comments.each_with_object(BASE.dup) do |comment, hash| if comment.text.include?("ActiveMocker.all_methods_safe") hash[:all_methods_safe] = ActiveMocker.module_eval(comment.text.delete("#")) elsif comment.text.include?("ActiveMocker.safe_methods") hash.merge!(ActiveMocker.module_eval(comment.text.delete("#"))) else hash end end end