Sha256: 3c7c51c5331d71033b105dcf706aafb9ddcaaa84c7535c628c87228bffa6378f
Contents?: true
Size: 761 Bytes
Versions: 1
Compression:
Stored size: 761 Bytes
Contents
# TODO move somewhere require 'active_support/all' module Seory class Runtime delegate :action_name, to: :controller CONTENTS = %w[title h1 h2 meta_description meta_keywords canonical_url image_url].map(&:to_sym) attr_reader :controller def initialize(page_contents, controller) @page_contents = page_contents @controller = controller end CONTENTS.each do |name| define_method(name) { calculate_content_for(name) } end private def calculate_content_for(name) case page_content = @page_contents.content_for(name) when String page_content when ->(o) { o.respond_to?(:call) } instance_exec(&page_content) else raise 'BUG' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
seory-0.0.1 | lib/seory/runtime.rb |