Module: Pixelator

Defined in:
lib/pixelator.rb,
lib/pixelator/engine.rb,
lib/pixelator/version.rb

Defined Under Namespace

Classes: Engine

Constant Summary collapse

VERSION =
"0.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.config_fileObject

Returns the value of attribute config_file.



10
11
12
# File 'lib/pixelator.rb', line 10

def config_file
  @config_file
end

.dataObject

Returns the value of attribute data.



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

def data
  @data
end

.run_envsObject

Returns the value of attribute run_envs.



11
12
13
# File 'lib/pixelator.rb', line 11

def run_envs
  @run_envs
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Pixelator)

    the object that the method was called on



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pixelator.rb', line 14

def self.configure
  self.run_envs = ['production']
  yield(self) if block_given?
  self.data = HashWithIndifferentAccess.new
  self.data[:pixels] = YAML.load_file(config_file).with_indifferent_access
  self.data[:pixels].each do |k,v|
    if v.is_a?(Array)
      v.map! do |a|
        a['snippet'] = URI.escape(a['snippet'])
        a
      end
    end
  end
  self.data[:context] = HashWithIndifferentAccess.new
end

.contextObject



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

def self.context
  data[:context]
end

.pixelsObject



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

def self.pixels
  data[:pixels]
end