Loading lib/jsduck/examples.rb +2 −2 Original line number Diff line number Diff line require 'jsduck/util/json' require 'jsduck/null_object' require 'jsduck/util/null_object' require 'jsduck/grouped_asset' module JsDuck Loading @@ -11,7 +11,7 @@ module JsDuck if filename Examples.new(filename, opts) else NullObject.new(:to_array => [], :[] => nil) Util::NullObject.new(:to_array => [], :[] => nil) end end Loading lib/jsduck/guides.rb +2 −2 Original line number Diff line number Diff line require 'jsduck/logger' require 'jsduck/util/json' require 'jsduck/util/io' require 'jsduck/null_object' require 'jsduck/util/null_object' require 'jsduck/logger' require 'jsduck/grouped_asset' require 'jsduck/util/html' Loading @@ -16,7 +16,7 @@ module JsDuck if filename Guides.new(filename, formatter, opts) else NullObject.new(:to_array => [], :to_html => "", :[] => nil) Util::NullObject.new(:to_array => [], :to_html => "", :[] => nil) end end Loading lib/jsduck/importer.rb +2 −2 Original line number Diff line number Diff line require 'jsduck/util/json' require 'jsduck/null_object' require 'jsduck/util/null_object' require 'jsduck/logger' require 'jsduck/util/parallel' Loading Loading @@ -29,7 +29,7 @@ module JsDuck end def current_version NullObject.new(:[] => NullObject.new(:[] => true)) Util::NullObject.new(:[] => Util::NullObject.new(:[] => true)) end # Reads in data from all .json files in directory Loading lib/jsduck/null_object.rbdeleted 100644 → 0 +0 −19 Original line number Diff line number Diff line module JsDuck # A class that does nothing. # Responds to all methods by returning self, unless a hash passed to # constructor. # See: http://en.wikipedia.org/wiki/Null_Object_pattern class NullObject # Optionally takes a hash of method_name => return_value pairs, # making it return those values for those methods, sort of like # OpenStruct, but for all other methods self is still returned and # any number of arguments is accepted. def initialize(methods={}) @methods = methods end def method_missing(meth, *args, &block) @methods.has_key?(meth) ? @methods[meth] : self end end end lib/jsduck/util/null_object.rb 0 → 100644 +23 −0 Original line number Diff line number Diff line module JsDuck module Util # A class that does nothing. # Responds to all methods by returning self, unless a hash passed to # constructor. # See: http://en.wikipedia.org/wiki/Null_Object_pattern class NullObject # Optionally takes a hash of method_name => return_value pairs, # making it return those values for those methods, sort of like # OpenStruct, but for all other methods self is still returned and # any number of arguments is accepted. def initialize(methods={}) @methods = methods end def method_missing(meth, *args, &block) @methods.has_key?(meth) ? @methods[meth] : self end end end end Loading
lib/jsduck/examples.rb +2 −2 Original line number Diff line number Diff line require 'jsduck/util/json' require 'jsduck/null_object' require 'jsduck/util/null_object' require 'jsduck/grouped_asset' module JsDuck Loading @@ -11,7 +11,7 @@ module JsDuck if filename Examples.new(filename, opts) else NullObject.new(:to_array => [], :[] => nil) Util::NullObject.new(:to_array => [], :[] => nil) end end Loading
lib/jsduck/guides.rb +2 −2 Original line number Diff line number Diff line require 'jsduck/logger' require 'jsduck/util/json' require 'jsduck/util/io' require 'jsduck/null_object' require 'jsduck/util/null_object' require 'jsduck/logger' require 'jsduck/grouped_asset' require 'jsduck/util/html' Loading @@ -16,7 +16,7 @@ module JsDuck if filename Guides.new(filename, formatter, opts) else NullObject.new(:to_array => [], :to_html => "", :[] => nil) Util::NullObject.new(:to_array => [], :to_html => "", :[] => nil) end end Loading
lib/jsduck/importer.rb +2 −2 Original line number Diff line number Diff line require 'jsduck/util/json' require 'jsduck/null_object' require 'jsduck/util/null_object' require 'jsduck/logger' require 'jsduck/util/parallel' Loading Loading @@ -29,7 +29,7 @@ module JsDuck end def current_version NullObject.new(:[] => NullObject.new(:[] => true)) Util::NullObject.new(:[] => Util::NullObject.new(:[] => true)) end # Reads in data from all .json files in directory Loading
lib/jsduck/null_object.rbdeleted 100644 → 0 +0 −19 Original line number Diff line number Diff line module JsDuck # A class that does nothing. # Responds to all methods by returning self, unless a hash passed to # constructor. # See: http://en.wikipedia.org/wiki/Null_Object_pattern class NullObject # Optionally takes a hash of method_name => return_value pairs, # making it return those values for those methods, sort of like # OpenStruct, but for all other methods self is still returned and # any number of arguments is accepted. def initialize(methods={}) @methods = methods end def method_missing(meth, *args, &block) @methods.has_key?(meth) ? @methods[meth] : self end end end
lib/jsduck/util/null_object.rb 0 → 100644 +23 −0 Original line number Diff line number Diff line module JsDuck module Util # A class that does nothing. # Responds to all methods by returning self, unless a hash passed to # constructor. # See: http://en.wikipedia.org/wiki/Null_Object_pattern class NullObject # Optionally takes a hash of method_name => return_value pairs, # making it return those values for those methods, sort of like # OpenStruct, but for all other methods self is still returned and # any number of arguments is accepted. def initialize(methods={}) @methods = methods end def method_missing(meth, *args, &block) @methods.has_key?(meth) ? @methods[meth] : self end end end end