Class: Dayvan::Validation
- Inherits:
-
Object
- Object
- Dayvan::Validation
- Defined in:
- lib/dayvan/validation.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize(path) ⇒ Validation
constructor
A new instance of Validation.
- #src ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(path) ⇒ Validation
Returns a new instance of Validation.
11 12 13 |
# File 'lib/dayvan/validation.rb', line 11 def initialize(path) self.path = path end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/dayvan/validation.rb', line 9 def path @path end |
Class Method Details
.all(path) ⇒ Object
5 6 7 |
# File 'lib/dayvan/validation.rb', line 5 def self.all(path) path.exist? && new(path) end |
Instance Method Details
#compile ⇒ Object
19 20 21 22 23 24 |
# File 'lib/dayvan/validation.rb', line 19 def compile CoffeeScript::Parser.new.parse(src). children. find {|node| node.is_a?(CoffeeScript::CodeNode)}. compile(:indent => '') end |
#src ⇒ Object
15 16 17 |
# File 'lib/dayvan/validation.rb', line 15 def src path.read end |
#to_json ⇒ Object
26 27 28 |
# File 'lib/dayvan/validation.rb', line 26 def to_json compile.to_json end |