lib/tap/support/lazy_attributes.rb in bahuvrihi-tap-0.10.7 vs lib/tap/support/lazy_attributes.rb in bahuvrihi-tap-0.10.8

- old
+ new

@@ -1,9 +1,24 @@ require 'tap/support/lazydoc' module Tap module Support + + # LazyAttributes adds methods to declare class-level accessors + # for Lazydoc attributes. The source_file for the class must + # be set manually. + # + # # ConstName::key value + # class ConstName + # extend LazyAttributes + # + # self.source_file = __FILE__ + # lazy_attr :key + # end + # + # ConstName::key.subject # => 'value' + # module LazyAttributes # The source_file for self. Must be set independently. attr_accessor :source_file @@ -19,10 +34,10 @@ instance_eval %Q{def #{key}; @#{key} ||= get_lazy_attr('#{attribute}'); end} end private - def get_lazy_attr(attribute) + def get_lazy_attr(attribute) # :nodoc: lazydoc[self.to_s][attribute] ||= Lazydoc::Comment.new end end end \ No newline at end of file