### Home Classes Methods

### In Files

- lib/rabbit/theme/searcher.rb

### Methods

- ::new
- #_collect_theme
- #absolute_path?
- #add_image_path
- #add_theme_path
- #collect_all_theme
- #collect_image_theme
- #collect_theme
- #find_file
- #find_theme
- #image_dir
- #image_load_path
- #in_theme
- #pop_theme
- #push_theme
- #theme_dir
- #theme_load_path

### Class/Module Index

Quicksearch

- Rabbit
- Rabbit::AAFigureCanNotHandleError
- Rabbit::Action
- Rabbit::ApplyFinish
- Rabbit::AuthorConfiguration
- Rabbit::BlockDiagCanNotHandleError
- Rabbit::CantAllocateColorError
- Rabbit::CantFindHTMLTemplate
- Rabbit::CantFindThemeRDTemplate
- Rabbit::Canvas
- Rabbit::Command
- Rabbit::Command::Rabbit
- Rabbit::Command::RabbitSlide
- Rabbit::Command::RabbitTheme
- Rabbit::Config
- Rabbit::Console
- Rabbit::Converter
- Rabbit::CursorManager
- Rabbit::DependencyCanvas
- Rabbit::DiaCanNotHandleError
- Rabbit::DirtyCount
- Rabbit::EPSCanNotHandleError
- Rabbit::Element
- Rabbit::Element::Author
- Rabbit::Element::Base
- Rabbit::Element::Base::DrawHook
- Rabbit::Element::BlockElement
- Rabbit::Element::BlockHorizontalCentering
- Rabbit::Element::BlockQuote
- Rabbit::Element::Body
- Rabbit::Element::ClassName
- Rabbit::Element::Code
- Rabbit::Element::Comment
- Rabbit::Element::Container
- Rabbit::Element::ContainerElement
- Rabbit::Element::ContentSource
- Rabbit::Element::CustomTag
- Rabbit::Element::Date
- Rabbit::Element::DeletedText
- Rabbit::Element::DescriptionContent
- Rabbit::Element::DescriptionList
- Rabbit::Element::DescriptionListItem
- Rabbit::Element::DescriptionTerm
- Rabbit::Element::Emphasis
- Rabbit::Element::EnumList
- Rabbit::Element::EnumListItem
- Rabbit::Element::FootText
- Rabbit::Element::FootTextBlock
- Rabbit::Element::Footnote
- Rabbit::Element::HeadLine
- Rabbit::Element::Image
- Rabbit::Element::ImageTitleSlide
- Rabbit::Element::Index
- Rabbit::Element::IndexSlide
- Rabbit::Element::IndexThumbnail
- Rabbit::Element::IndexThumbnailRow
- Rabbit::Element::Institution
- Rabbit::Element::ItemList
- Rabbit::Element::ItemListItem
- Rabbit::Element::Keyboard
- Rabbit::Element::Keyword
- Rabbit::Element::MethodDescription
- Rabbit::Element::MethodKind
- Rabbit::Element::MethodList
- Rabbit::Element::MethodListItem
- Rabbit::Element::MethodName
- Rabbit::Element::MethodTerm
- Rabbit::Element::Note
- Rabbit::Element::Paragraph
- Rabbit::Element::Place
- Rabbit::Element::PopplerPage
- Rabbit::Element::PopplerSlide
- Rabbit::Element::PopplerTitleSlide
- Rabbit::Element::PreformattedBlock
- Rabbit::Element::PreformattedText
- Rabbit::Element::ReferText
- Rabbit::Element::Slide
- Rabbit::Element::SlideElement
- Rabbit::Element::Subscript
- Rabbit::Element::Subtitle
- Rabbit::Element::Superscript
- Rabbit::Element::SyntaxHighlightingBlock
- Rabbit::Element::SyntaxHighlightingText
- Rabbit::Element::Table
- Rabbit::Element::TableBody
- Rabbit::Element::TableCell
- Rabbit::Element::TableHead
- Rabbit::Element::TableHeader
- Rabbit::Element::TableRow
- Rabbit::Element::Text
- Rabbit::Element::TextBlock
- Rabbit::Element::TextBlockElement
- Rabbit::Element::TextContainer
- Rabbit::Element::TextContainerElement
- Rabbit::Element::TextElement
- Rabbit::Element::TextRenderer
- Rabbit::Element::Title
- Rabbit::Element::TitleSlide
- Rabbit::Element::Variable
- Rabbit::Element::Verbatim
- Rabbit::Element::Video
- Rabbit::Element::WaitBlock
- Rabbit::Element::WaitTag
- Rabbit::Element::When
- Rabbit::Element::Where
- Rabbit::EmbedFrame
- Rabbit::Error
- Rabbit::Format
- Rabbit::Format::ConvenienceTextFormatter
- Rabbit::Format::Foreground
- Rabbit::Format::Formatter
- Rabbit::Format::Size
- Rabbit::Format::SpanTextFormatter
- Rabbit::Format::ValueContainerFormatter
- Rabbit::Frame
- Rabbit::Front
- Rabbit::Front::PublicLevel
- Rabbit::GIMPCanNotHandleError
- Rabbit::GemBuilder
- Rabbit::GemFinder
- Rabbit::Gesture
- Rabbit::Gesture::Handler
- Rabbit::Gesture::Processor
- Rabbit::GetText
- Rabbit::Graffiti
- Rabbit::Graffiti::ConfigDialog
- Rabbit::Graffiti::Processor
- Rabbit::HTML
- Rabbit::HTML::Generator
- Rabbit::ImageFileDoesNotExistError
- Rabbit::ImageLoadError
- Rabbit::ImageLoadWithExternalCommandError
- Rabbit::ImageLoader
- Rabbit::ImageManipulable
- Rabbit::ImageManipulable::Base
- Rabbit::ImageManipulable::Default
- Rabbit::ImageManipulable::Dia
- Rabbit::ImageManipulable::EPS
- Rabbit::ImageManipulable::GIMP
- Rabbit::ImageManipulable::PDF
- Rabbit::ImageManipulable::SVG
- Rabbit::ImmutableSourceTypeError
- Rabbit::InfoWindow
- Rabbit::InvalidImageSizeError
- Rabbit::InvalidMotionError
- Rabbit::Keys
- Rabbit::Keys::Alt
- Rabbit::Keys::Control
- Rabbit::Keys::Shift
- Rabbit::Logger
- Rabbit::Logger::Base
- Rabbit::Logger::GUI
- Rabbit::Logger::STDERR
- Rabbit::Logger::Severity
- Rabbit::Menu
- Rabbit::ModuleLoader
- Rabbit::NoPrintSupportError
- Rabbit::NotAvailableInterfaceError
- Rabbit::NotExistError
- Rabbit::NotFileError
- Rabbit::NotReadableError
- Rabbit::NullFrame
- Rabbit::ParseError
- Rabbit::ParseFinish
- Rabbit::Parser
- Rabbit::Parser::Base
- Rabbit::Parser::Ext
- Rabbit::Parser::Ext::AAFigure
- Rabbit::Parser::Ext::BlockDiag
- Rabbit::Parser::Ext::CodeRay
- Rabbit::Parser::Ext::CodeRay::RabbitEncoder
- Rabbit::Parser::Ext::Emacs
- Rabbit::Parser::Ext::Enscript
- Rabbit::Parser::Ext::Entity
- Rabbit::Parser::Ext::Escape
- Rabbit::Parser::Ext::Image
- Rabbit::Parser::Ext::Image::Private
- Rabbit::Parser::Ext::Inline
- Rabbit::Parser::Ext::TeX
- Rabbit::Parser::Ext::Video
- Rabbit::Parser::Image
- Rabbit::Parser::Markdown
- Rabbit::Parser::Markdown::Converter
- Rabbit::Parser::NoteSetter
- Rabbit::Parser::PDF
- Rabbit::Parser::PauseSupport
- Rabbit::Parser::RD
- Rabbit::Parser::RD::Ext
- Rabbit::Parser::RD::Ext::Base
- Rabbit::Parser::RD::Ext::BlockVerbatim
- Rabbit::Parser::RD::Ext::CharacterReference
- Rabbit::Parser::RD::Ext::Image
- Rabbit::Parser::RD::Ext::InlineVerbatim
- Rabbit::Parser::RD::Ext::Refer
- Rabbit::Parser::RD::Ext::Video
- Rabbit::Parser::RD::RD2RabbitVisitor
- Rabbit::Parser::RD::Visitor
- Rabbit::Parser::SlidePropertySetter
- Rabbit::Parser::Wiki
- Rabbit::Parser::Wiki::RabbitOutput
- Rabbit::Parser::Wiki::RabbitOutput::BlockPlugin
- Rabbit::Parser::Wiki::RabbitOutput::InlinePlugin
- Rabbit::Parser::Wiki::RabbitOutput::InlinePlugin::Private
- Rabbit::PathManipulatable
- Rabbit::Progress
- Rabbit::READMEParser
- Rabbit::RT2RabbitVisitor
- Rabbit::Renderer
- Rabbit::Renderer::Base
- Rabbit::Renderer::Color
- Rabbit::Renderer::Display
- Rabbit::Renderer::Display::Base
- Rabbit::Renderer::Display::ButtonHandler
- Rabbit::Renderer::Display::ClutterEmbed
- Rabbit::Renderer::Display::Cursor
- Rabbit::Renderer::Display::DrawingArea
- Rabbit::Renderer::Display::DrawingAreaBase
- Rabbit::Renderer::Display::DrawingAreaPrimitive
- Rabbit::Renderer::Display::DrawingAreaViewOnly
- Rabbit::Renderer::Display::GL
- Rabbit::Renderer::Display::Gesture
- Rabbit::Renderer::Display::Graffiti
- Rabbit::Renderer::Display::HookHandler
- Rabbit::Renderer::Display::Info
- Rabbit::Renderer::Display::KeyHandler
- Rabbit::Renderer::Display::Magnifier
- Rabbit::Renderer::Display::Mask
- Rabbit::Renderer::Display::Menu
- Rabbit::Renderer::Display::Progress
- Rabbit::Renderer::Display::ScrollHandler
- Rabbit::Renderer::Display::Search
- Rabbit::Renderer::Display::Spotlight
- Rabbit::Renderer::Engine
- Rabbit::Renderer::Engine::Cairo
- Rabbit::Renderer::Engine::GDK
- Rabbit::Renderer::GL
- Rabbit::Renderer::Kernel
- Rabbit::Renderer::Pixmap
- Rabbit::Renderer::Pixmap::Base
- Rabbit::Renderer::Pixmap::Cairo
- Rabbit::Renderer::Pixmap::GDK
- Rabbit::Renderer::Pixmap::GL
- Rabbit::Renderer::Print
- Rabbit::Renderer::Print::Base
- Rabbit::Renderer::Print::Cairo
- Rabbit::Renderer::Print::Layout2
- Rabbit::Renderer::Print::LayoutBase
- Rabbit::Renderer::Print::LayoutMore
- Rabbit::Renderer::Print::Multiple
- Rabbit::SOAP
- Rabbit::SOAP::Driver
- Rabbit::SOAP::Server
- Rabbit::ScreenInfo
- Rabbit::SearchWindow
- Rabbit::Searcher
- Rabbit::SlideConfiguration
- Rabbit::Source
- Rabbit::Source::ARGF
- Rabbit::Source::Base
- Rabbit::Source::File
- Rabbit::Source::Hiki
- Rabbit::Source::LimitAccessInterval
- Rabbit::Source::Memory
- Rabbit::Source::SlideShare
- Rabbit::Source::URI
- Rabbit::SourceGenerator
- Rabbit::SourceGenerator::Hiki
- Rabbit::SourceGenerator::Markdown
- Rabbit::SourceGenerator::RD
- Rabbit::SourceUnreadableError
- Rabbit::Stock
- Rabbit::SystemRunner
- Rabbit::Task
- Rabbit::Task::Slide
- Rabbit::Task::SlideShare
- Rabbit::Task::SlideShare::Error
- Rabbit::Task::Theme
- Rabbit::TeXCanNotHandleError
- Rabbit::TemporaryFile
- Rabbit::Theme
- Rabbit::Theme::Applier
- Rabbit::Theme::DirectoryEntry
- Rabbit::Theme::ElementContainer
- Rabbit::Theme::Entry
- Rabbit::Theme::FileEntry
- Rabbit::Theme::GemEntry
- Rabbit::Theme::ImageDirectoryEntry
- Rabbit::Theme::ImageFileEntry
- Rabbit::Theme::ImageGemEntry
- Rabbit::Theme::Manager
- Rabbit::Theme::Searcher
- Rabbit::ThemeConfiguration
- Rabbit::ThemeExit
- Rabbit::TrackBall
- Rabbit::TrackBall::Vector
- Rabbit::UnknownCursorTypeError
- Rabbit::UnknownPropertyError
- Rabbit::UnsupportedFormatError
- Rabbit::Utils
- Rabbit::VideoWindow
- Rabbit::VideoWindow::VideoWidget
- Rabbit::XMLRPC
- Rabbit::XMLRPC::Client
- Rabbit::XMLRPC::Server
- Rabbit::XMLRPC::Servlet
- OptionParser
- OptionParser::Category
- OptionParser::List
- OptionParser::Switch
- Cairo
- Cairo::Context
- Gtk
- Gtk::Action
- Pango
- Pango::Context
- Object

No matching classes.

# Rabbit::Theme::Searcher

### Public Class Methods

new(*args, &blocks) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 8
    def initialize(*args, &blocks)
      @theme_stack = []
      @image_entries = []
      super
    end

### Public Instance Methods

_collect_theme(path, entry_classes, converter=nil, &block) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 136
    def _collect_theme(path, entry_classes, converter=nil, &block)
      converter ||= "theme_dir"
      themes = []
      theme_names = {}
      path.each do |dir|
        base_name = __send__(converter, dir)
        if File.directory?(base_name)
          Dir.foreach(base_name) do |theme|
            next if /\A..?\z/ =~ theme
            next if theme_names.has_key?(theme)
            theme_dir = File.join(File.expand_path(base_name), theme)
            entry_classes.each do |entry_class|
              entry = entry_class.new(@logger, theme_dir, theme)
              if entry.available?
                block.call(entry) if block
                themes << entry
                theme_names[theme] = true
                break
              end
            end
          end
        end
      end
      themes.sort
    end

absolute_path?(path) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 100
    def absolute_path?(path)
      Pathname.new(path).absolute?
    end

add_image_path(name) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 29
    def add_image_path(name)
      @image_entries << find_theme(name, true)
    end

Also aliased as: add_theme_path
add_theme_path(name) click to toggle source

for backward compatibility

Alias for: add_image_path
collect_all_theme(&block) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 104
    def collect_all_theme(&block)
      theme_names = {}
      themes = []
      callback = Proc.new do |entry|
        unless theme_names.has_key?(entry.name)
          theme_names[entry.name] = true
          themes << entry
          block.call(entry) if block
        end
      end
      collect_image_theme(&callback)
      collect_theme(&callback)
      themes.sort
    end

collect_image_theme(&block) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 123
    def collect_image_theme(&block)
      _collect_theme(image_load_path, [ImageFileEntry, ImageDirectoryEntry],
                     "image_dir", &block)
    end

collect_theme(&block) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 119
    def collect_theme(&block)
      _collect_theme(theme_load_path, [FileEntry, DirectoryEntry], &block)
    end

find_file(target, themes=nil) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 86
    def find_file(target, themes=nil)
      return target if absolute_path?(target)
      themes ||= @theme_stack + @image_entries
      found_entry = themes.find do |entry|
        entry.have_file?(target)
      end
      if found_entry.nil?
        names = themes.collect {|entry| entry.name}
        raise LoadError,
              "can't find file in themes #{names.inspect}: #{target}."
      end
      found_entry.full_path(target)
    end

find_theme(theme_name=name, only_image=false) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 45
    def find_theme(theme_name=name, only_image=false)
      if theme_name == "."
        if only_image
          entry = ImageDirectoryEntry.new(@logger, ".", ".")
        else
          entry = DirectoryEntry.new(@logger, ".", ".")
        end
        return entry if entry.available?
      end

      unless only_image
        entry = FileEntry.new(@logger, base_directory, theme_name)
        return entry if entry.available?
      end

      if only_image
        collector = "collect_image_theme"
      else
        collector = "collect_all_theme"
      end
      found_entry = nil
      __send__(collector) do |entry|
        if theme_name == entry.name
          found_entry = entry
          break
        end
      end

      if found_entry.nil?
        if only_image
          entry = ImageGemEntry.new(@logger, theme_name)
        else
          entry = GemEntry.new(@logger, theme_name)
        end
        return entry if entry.available?
        raise LoadError, "can't find theme: #{theme_name}."
      end

      found_entry
    end

image_dir(base_dir) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 41
    def image_dir(base_dir)
      File.join(base_dir, 'rabbit', 'image')
    end

image_load_path() click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 132
    def image_load_path
      Config::IMAGE_PATH + $LOAD_PATH
    end

in_theme(entry) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 22
    def in_theme(entry)
      push_theme(entry)
      yield(entry)
    ensure
      pop_theme
    end

pop_theme() click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 18
    def pop_theme
      @theme_stack.pop
    end

push_theme(entry) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 14
    def push_theme(entry)
      @theme_stack.push(entry)
    end

theme_dir(base_dir) click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 37
    def theme_dir(base_dir)
      File.join(base_dir, 'rabbit', 'theme')
    end

theme_load_path() click to toggle source

    # File lib/rabbit/theme/searcher.rb, line 128
    def theme_load_path
      $LOAD_PATH
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.