Class: Rabbit::Theme::GemEntry

Inherits:
Entry
  • Object
show all
Defined in:
lib/rabbit/theme/entry.rb

Direct Known Subclasses

ImageGemEntry

Constant Summary

Constants inherited from Entry

Entry::PROPERTY_BASE_NAME, Entry::THEME_BASE_NAME

Constants included from GetText

GetText::DOMAIN

Instance Attribute Summary

Attributes inherited from Entry

#abstract, #dependencies, #description, #logger, #name, #parameters, #title

Instance Method Summary collapse

Methods inherited from Entry

#<=>, #category, #data_dir, #have_file?, #image_theme?, #property_editable?

Methods included from GetText

included

Constructor Details

#initialize(logger, name) ⇒ GemEntry

Returns a new instance of GemEntry.


158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/rabbit/theme/entry.rb', line 158

def initialize(logger, name)
  @spec = nil
  if valid_gem_name?(name)
    finder = GemFinder.new(logger)
    begin
      @spec = finder.find(name, "#{ThemeConfiguration::GEM_NAME_PREFIX}-")
    rescue Gem::GemNotFoundException
    end
  end
  theme_dir = nil
  theme_dir = @spec.gem_dir if @spec
  super(logger, theme_dir, name)
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)

172
173
174
# File 'lib/rabbit/theme/entry.rb', line 172

def available?
  @theme_dir and super
end

#filesObject


184
185
186
# File 'lib/rabbit/theme/entry.rb', line 184

def files
  Dir.glob(File.join(data_dir, "*")).sort
end

#full_path(target) ⇒ Object


180
181
182
# File 'lib/rabbit/theme/entry.rb', line 180

def full_path(target)
  File.join(data_dir, target)
end

#theme_fileObject


176
177
178
# File 'lib/rabbit/theme/entry.rb', line 176

def theme_file
  File.join(@theme_dir, "#{THEME_BASE_NAME}.rb")
end