Sha256: d7a056cf593f4ea0a782debcff5d684e1079bc429e25056e233f31806a4a3fec
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
require "forwardable" require "active_support/core_ext/string/starts_ends_with" require "active_support/core_ext/string/inquiry" class Symbol extend Forwardable def_delegators :to_s, :inquiry, :ends_with? # @!method inquiry() # Allows for any symbol to be "inquired" with a call ending with a `?` # # @return [true] if the method name matches the Symbol # @return [false] otherwise # @example # :foo.foo? => true # :foo.bar? => false # @example Error # :foo.foo => raises NoMethodError # @see http://api.rubyonrails.org/v3.2.5/classes/String.html#method-i-inquiry # String#inquiry in ActiveSupport # @!method ends_with?(str) # Check that the Symbol ends with the given String # # @param str [String] string to check for # @return [true] if the Symbol ends with the given String # @return [false] otherwise # @see http://api.rubyonrails.org/v3.2.5 String#ends_with? in ActiveSupport private # Passes method names ending with `?` through to `#to_s.inquiry` def method_missing(method_name, *arguments, &block) if arguments.empty? and block.nil? and method_name.ends_with?("?") self.inquiry.send(method_name) else super end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dionysus-2.2.0.0.pre1 | lib/dionysus/symbol/inquiry.rb |