Sha256: 4ad26235a495216cd306e703c67c1a8bf359c61b4c7f45dcc79edd580c1a6dc4
Contents?: true
Size: 1022 Bytes
Versions: 4
Compression:
Stored size: 1022 Bytes
Contents
require "naught" module Twitter NullObject = Naught.build do |config| # rubocop:disable Metrics/BlockLength include Comparable config.black_hole config.define_explicit_conversions config.define_implicit_conversions config.predicates_return false def ! true end def respond_to?(*) true end def instance_of?(klass) raise(TypeError, "class or module required") unless klass.is_a?(Class) self.class == klass end def kind_of?(mod) raise(TypeError, "class or module required") unless mod.is_a?(Module) self.class.ancestors.include?(mod) end alias_method :is_a?, :kind_of? def <=>(other) if other.is_a?(self.class) 0 else -1 end end def nil? true end def as_json(*) "null" end def to_json(*args) nil.to_json(*args) end def presence nil end def blank? true end def present? false end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
twitter-8.1.0 | lib/twitter/null_object.rb |
twitter-8.0.1 | lib/twitter/null_object.rb |
twitter-8.0.0 | lib/twitter/null_object.rb |
twitter-8.0.0.rc.1 | lib/twitter/null_object.rb |