Class: Deckr::Deck

Inherits:
Resource show all
Defined in:
lib/deckr/deck.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#parent

Instance Method Summary collapse

Methods inherited from Resource

#==

Constructor Details

#initialize(url = ".", path = "deck") ⇒ Deck

Returns a new instance of Deck.



8
9
10
11
12
13
14
# File 'lib/deckr/deck.rb', line 8

def initialize(url=".", path="deck")
  @parent = nil
  @url, @path = url, path
  @style = nil
  @transition = nil
  @extensions = {}
end

Instance Attribute Details

#pathObject (readonly) Also known as: name

Returns the value of attribute path.



5
6
7
# File 'lib/deckr/deck.rb', line 5

def path
  @path
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/deckr/deck.rb', line 5

def url
  @url
end

Instance Method Details

#contentObject



60
61
62
# File 'lib/deckr/deck.rb', line 60

def content
  ""
end

#coreObject



26
27
28
# File 'lib/deckr/deck.rb', line 26

def core
  package("core")
end

#disable(*args) ⇒ Object



45
46
47
48
49
50
# File 'lib/deckr/deck.rb', line 45

def disable(*args)
  args.each do |name|
    @extensions.delete(name.to_sym)
  end
  extensions
end

#enable(*args) ⇒ Object



38
39
40
41
42
43
# File 'lib/deckr/deck.rb', line 38

def enable(*args)
  args.each do |name|
    @extensions[name.to_sym] ||= package("extensions/#{name}")
  end
  extensions
end

#exist?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/deckr/deck.rb', line 56

def exist?
  File.directory?(path)
end

#extensionsObject



52
53
54
# File 'lib/deckr/deck.rb', line 52

def extensions
  @extensions.values
end

#package(name) ⇒ Object



21
22
23
24
# File 'lib/deckr/deck.rb', line 21

def package(name)
  @packages ||= {}
  @packages[name.to_sym] ||= Package.new(self, name)
end

#resource(name) ⇒ Object



16
17
18
19
# File 'lib/deckr/deck.rb', line 16

def resource(name)
  @resources ||= {}
  @resources[name.to_sym] ||= Resource.new(self, name)
end

#style(name = (omitted=true)) ⇒ Object



30
31
32
# File 'lib/deckr/deck.rb', line 30

def style(name=(omitted=true))
  omitted ? @style : @style = (name && resource("themes/style/#{name}.css"))
end

#transition(name = (omitted=true)) ⇒ Object



34
35
36
# File 'lib/deckr/deck.rb', line 34

def transition(name=(omitted=true))
  omitted ? @transition : @transition = (name && resource("themes/transition/#{name}.css"))
end