Class: Deface::DSL::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/deface/dsl/context.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Context

Returns a new instance of Context.



4
5
6
7
# File 'lib/deface/dsl/context.rb', line 4

def initialize(name)
  @name = name
  @options = {}
end

Instance Method Details

#attributes(values) ⇒ Object



54
55
56
# File 'lib/deface/dsl/context.rb', line 54

def attributes(values)
  @options[:attributes] = values
end

#closing_selector(selector) ⇒ Object



46
47
48
# File 'lib/deface/dsl/context.rb', line 46

def closing_selector(selector)
  @options[:closing_selector] = selector
end

#create_overrideObject



9
10
11
12
13
14
15
16
# File 'lib/deface/dsl/context.rb', line 9

def create_override
  options = {
    :name => @name, 
    :virtual_path => @virtual_path,
  }.merge(@action || {}).merge(@source || {}).merge(@options)

  Deface::Override.new(options)
end

#disabledObject



62
63
64
# File 'lib/deface/dsl/context.rb', line 62

def disabled
  @options[:disabled] = true
end

#enabledObject



58
59
60
# File 'lib/deface/dsl/context.rb', line 58

def enabled
  @options[:disabled] = false
end

#original(markup) ⇒ Object



42
43
44
# File 'lib/deface/dsl/context.rb', line 42

def original(markup)
  @options[:original] = markup
end

#sequence(value) ⇒ Object



50
51
52
# File 'lib/deface/dsl/context.rb', line 50

def sequence(value)
  @options[:sequence] = value
end

#virtual_path(name) ⇒ Object



18
19
20
# File 'lib/deface/dsl/context.rb', line 18

def virtual_path(name)
  @virtual_path = name
end