Class: Deface::Environment

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

Defined Under Namespace

Classes: Overrides

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEnvironment

Returns a new instance of Environment.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/deface/environment.rb', line 10

def initialize
  @overrides    = Overrides.new
  @enabled      = true
  @haml_support = false
  @slim_support = false
  @actions      = []
  @sources      = []
  @namespaced   = false

  Deface::DEFAULT_ACTIONS.each { |action| register_action(action) }
  Deface::DEFAULT_SOURCES.each { |source| register_source(source) }
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



9
10
11
# File 'lib/deface/environment.rb', line 9

def enabled
  @enabled
end

#haml_supportObject

Returns the value of attribute haml_support.



9
10
11
# File 'lib/deface/environment.rb', line 9

def haml_support
  @haml_support
end

#namespacedObject

Returns the value of attribute namespaced.



9
10
11
# File 'lib/deface/environment.rb', line 9

def namespaced
  @namespaced
end

#overridesObject

Returns the value of attribute overrides.



9
10
11
# File 'lib/deface/environment.rb', line 9

def overrides
  @overrides
end

#slim_supportObject

Returns the value of attribute slim_support.



9
10
11
# File 'lib/deface/environment.rb', line 9

def slim_support
  @slim_support
end

Instance Method Details

#actionsObject



28
29
30
# File 'lib/deface/environment.rb', line 28

def actions
  @actions.dup
end

#register_action(action) ⇒ Object



23
24
25
26
# File 'lib/deface/environment.rb', line 23

def register_action(action)
  @actions << action
  Deface::DSL::Context.define_action_method(action.to_sym)
end

#register_source(source) ⇒ Object



32
33
34
35
# File 'lib/deface/environment.rb', line 32

def register_source(source)
  @sources << source
  Deface::DSL::Context.define_source_method(source.to_sym)
end

#sourcesObject



37
38
39
# File 'lib/deface/environment.rb', line 37

def sources
  @sources.dup
end