Class: Docks::Templates::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/docks/templates.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Template

Returns a new instance of Template.



10
11
12
13
14
# File 'lib/docks/templates.rb', line 10

def initialize(name, options = {})
  @path = name
  @matcher = options[:matches] || options[:for]
  @layout = options[:layout]
end

Instance Attribute Details

#layoutObject (readonly)

Returns the value of attribute layout.



4
5
6
# File 'lib/docks/templates.rb', line 4

def layout
  @layout
end

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/docks/templates.rb', line 4

def path
  @path
end

Class Method Details

.new(name, options = {}) ⇒ Object



6
7
8
# File 'lib/docks/templates.rb', line 6

def self.new(name, options = {})
  name.kind_of?(self) ? name : super
end

Instance Method Details

#matches?(id) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/docks/templates.rb', line 20

def matches?(id)
  !(@matcher =~ id).nil?
end