Class: Deckr::Deck
Instance Attribute Summary collapse
-
#path ⇒ Object
(also: #name)
readonly
Returns the value of attribute path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from Resource
Instance Method Summary collapse
- #content ⇒ Object
- #core ⇒ Object
- #disable(*args) ⇒ Object
- #enable(*args) ⇒ Object
- #exist? ⇒ Boolean
- #extensions ⇒ Object
-
#initialize(url = ".", path = "deck") ⇒ Deck
constructor
A new instance of Deck.
- #package(name) ⇒ Object
- #resource(name) ⇒ Object
- #style(name = (omitted=true)) ⇒ Object
- #transition(name = (omitted=true)) ⇒ Object
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
#path ⇒ Object (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 |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/deckr/deck.rb', line 5 def url @url end |
Instance Method Details
#content ⇒ Object
60 61 62 |
# File 'lib/deckr/deck.rb', line 60 def content "" end |
#core ⇒ Object
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
56 57 58 |
# File 'lib/deckr/deck.rb', line 56 def exist? File.directory?(path) end |
#extensions ⇒ Object
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 |