Sha256: da0eb5a00e14bbb6cb9bac3e2f512e8ff93af501b083308310ab871263df6008

Contents?: true

Size: 613 Bytes

Versions: 7

Compression:

Stored size: 613 Bytes

Contents

require 'erb'

module HaveAPI::Fs::Components
  class HelpFile < File
    def initialize(component, format)
      super()
      @component = @c = component
      @context = component.context
      @format = format
    end

    protected
    def template_path(klass)
      if klass.is_a?(::String)
        name = klass
        
      else
        name = klass.help_file ? klass.help_file.to_s : klass.name.split('::').last.underscore
      end

      HaveAPI::Fs::Help.find!(::File.join(@format.to_s, name + ".erb"))
    end

    def layout(layout_erb)
      layout_erb.result(binding { yield })
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
haveapi-fs-0.11.0 lib/haveapi/fs/components/help_file.rb
haveapi-fs-0.10.0 lib/haveapi/fs/components/help_file.rb
haveapi-fs-0.9.0 lib/haveapi/fs/components/help_file.rb
haveapi-fs-0.8.0 lib/haveapi/fs/components/help_file.rb
haveapi-fs-0.7.1 lib/haveapi/fs/components/help_file.rb
haveapi-fs-0.7.0 lib/haveapi/fs/components/help_file.rb
haveapi-fs-0.1.0 lib/haveapi/fs/components/help_file.rb