Sha256: c14d894098a647158e0fe6bafc1ccfff4618ef5479f94f56715ed097de3d5bd9
Contents?: true
Size: 427 Bytes
Versions: 4
Compression:
Stored size: 427 Bytes
Contents
module WannabeBool::Attributes def self.included(base) base.extend(ClassMethods) end module ClassMethods def attr_wannabe_bool(*attributes) attributes.each do |attr| raise ArgumentError, "#{attr} method is not defined." unless method_defined?(attr) next if method_defined?("#{attr}?") define_method("#{attr}?") do send(attr).to_b end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems