Class: Trifle::Docs::Harvester::Conveyor
- Inherits:
-
Object
- Object
- Trifle::Docs::Harvester::Conveyor
- Defined in:
- lib/trifle/docs/harvester.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(file:, url:, namespace:, cache:) ⇒ Conveyor
constructor
A new instance of Conveyor.
- #preload_cache ⇒ Object
Constructor Details
#initialize(file:, url:, namespace:, cache:) ⇒ Conveyor
Returns a new instance of Conveyor.
363 364 365 366 367 368 369 370 |
# File 'lib/trifle/docs/harvester.rb', line 363 def initialize(file:, url:, namespace:, cache:) @file = file @url = url @namespace = namespace @cache = cache preload_cache if cache end |
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
361 362 363 |
# File 'lib/trifle/docs/harvester.rb', line 361 def cache @cache end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
361 362 363 |
# File 'lib/trifle/docs/harvester.rb', line 361 def file @file end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
361 362 363 |
# File 'lib/trifle/docs/harvester.rb', line 361 def namespace @namespace end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
361 362 363 |
# File 'lib/trifle/docs/harvester.rb', line 361 def url @url end |
Instance Method Details
#data ⇒ Object
376 377 378 379 380 |
# File 'lib/trifle/docs/harvester.rb', line 376 def data @data = nil unless cache @data ||= ::File.read(file, encoding: 'utf-8') end |
#preload_cache ⇒ Object
372 373 374 |
# File 'lib/trifle/docs/harvester.rb', line 372 def preload_cache # NOTE: harvester is responsible for cache implementation end |