Class: Mako::Core
- Inherits:
-
Object
- Object
- Mako::Core
- Includes:
- ERB::Util, ViewHelpers
- Defined in:
- lib/mako/core.rb
Instance Attribute Summary collapse
-
#constructor ⇒ Object
readonly
Returns the value of attribute constructor.
-
#feeds ⇒ Object
readonly
Returns the value of attribute feeds.
-
#renderers ⇒ Object
readonly
Returns the value of attribute renderers.
-
#requester ⇒ Object
readonly
Returns the value of attribute requester.
-
#subscription_list ⇒ Object
readonly
Returns the value of attribute subscription_list.
-
#writer ⇒ Object
readonly
Returns the value of attribute writer.
Instance Method Summary collapse
-
#build ⇒ Object
Gets list of feed_urls, requests each of them and uses the constructor to make Feed and Article objects, then calls to the renderers to render the page and stylesheets.
-
#get_binding ⇒ Binding
Returns the Binding of Core for the ERB renderer.
-
#initialize(args) ⇒ Core
constructor
A new instance of Core.
Methods included from ViewHelpers
#last_updated, #quick_nav, #today
Constructor Details
#initialize(args) ⇒ Core
Returns a new instance of Core.
11 12 13 14 15 16 17 18 |
# File 'lib/mako/core.rb', line 11 def initialize(args) @feeds = [] @requester = args.fetch(:requester) @constructor = args.fetch(:constructor) @renderers = args.fetch(:renderers) @writer = args.fetch(:writer) @subscription_list = args.fetch(:subscription_list) end |
Instance Attribute Details
#constructor ⇒ Object (readonly)
Returns the value of attribute constructor.
8 9 10 |
# File 'lib/mako/core.rb', line 8 def constructor @constructor end |
#feeds ⇒ Object (readonly)
Returns the value of attribute feeds.
8 9 10 |
# File 'lib/mako/core.rb', line 8 def feeds @feeds end |
#renderers ⇒ Object (readonly)
Returns the value of attribute renderers.
8 9 10 |
# File 'lib/mako/core.rb', line 8 def renderers @renderers end |
#requester ⇒ Object (readonly)
Returns the value of attribute requester.
8 9 10 |
# File 'lib/mako/core.rb', line 8 def requester @requester end |
#subscription_list ⇒ Object (readonly)
Returns the value of attribute subscription_list.
8 9 10 |
# File 'lib/mako/core.rb', line 8 def subscription_list @subscription_list end |
#writer ⇒ Object (readonly)
Returns the value of attribute writer.
8 9 10 |
# File 'lib/mako/core.rb', line 8 def writer @writer end |
Instance Method Details
#build ⇒ Object
Gets list of feed_urls, requests each of them and uses the constructor to make Feed and Article objects, then calls to the renderers to render the page and stylesheets.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mako/core.rb', line 23 def build log_configuration_information if subscription_list.empty? Mako.logger.warn 'No feeds were found in your subscriptions file. Please add feeds and try again.' return end log_time do request_and_build_feeds renderers.each do |renderer| renderer_instance = renderer.new(bound: self) writer.new(renderer: renderer_instance, destination: File.(renderer_instance.file_path, Mako.config.destination)).write end end end |
#get_binding ⇒ Binding
Returns the Binding of Core for the ERB renderer. Binding encapsulates the execution context for the Core class, and makes all of the variables and methods of Core available to the renderer.
46 47 48 |
# File 'lib/mako/core.rb', line 46 def get_binding binding end |