Sha256: ca7b397aefdf2fd0ce8f782a1c35173e0f9da3655a99fa25f373838be45a395f

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

require 'rubygems'
require 'activesupport'

module Taza
  class Site
    def initialize
      define_site_pages
    end

    def define_site_pages
      Dir.glob(path) do |file|
        require file

        page_name = File.basename(file,'.rb')
        self.class.class_eval <<-EOS
          def #{page_name}
            yield '#{page_name}'.camelcase.constantize.new
          end
        EOS
      end
    end

    def path
      File.join('pages',self.class.to_s.underscore,'*.rb')
    end
  end 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
taza-0.5.0 lib/taza/site.rb