Class: Dayvan::Security

Inherits:
Object
  • Object
show all
Defined in:
lib/dayvan/security.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Security

Returns a new instance of Security.



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

def initialize(path)
  self.path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

Class Method Details

.allObject



5
6
7
# File 'lib/dayvan/security.rb', line 5

def self.all
  new(Dayvan.project.security_path)
end

Instance Method Details

#compileObject



19
20
21
22
23
24
# File 'lib/dayvan/security.rb', line 19

def compile
  CoffeeScript::Parser.new.parse(src).
    children.
    find {|node| node.is_a?(CoffeeScript::CodeNode)}.
    compile(:indent => '')
end

#srcObject



15
16
17
# File 'lib/dayvan/security.rb', line 15

def src
  path.read
end

#to_jsonObject



26
27
28
# File 'lib/dayvan/security.rb', line 26

def to_json
  compile.to_json
end