Module: Schai

Defined in:
lib/schai.rb,
lib/schai/cli.rb,
lib/schai/version.rb,
lib/schai/json_schema/js_root.rb,
lib/schai/json_schema/js_array.rb,
lib/schai/json_schema/js_object.rb,
lib/schai/json_schema/js_property.rb

Defined Under Namespace

Classes: CLI, JsArray, JsObject, JsProperty, JsRoot

Constant Summary collapse

VERSION =
"0.2.1"

Class Method Summary collapse

Class Method Details

.current_parsing_file?(path) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/schai.rb', line 18

def self.current_parsing_file? path
  File.expand_path("../#{path}", Schai.path.last) == Schai.path.last
end

.parse(params) ⇒ Object



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

def self.parse params
  JsRoot.parse params
end

.parse_file(path) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/schai.rb', line 22

def self.parse_file path
  if Schai.path.empty?
    Schai.path << path
    ret = parse YAML.load_file(path)
    Schai.path.pop
  else
    expand_path = File.expand_path("../#{path}", Schai.path.last)
    Schai.path << expand_path
    ret = parse YAML.load_file(expand_path)
    Schai.path.pop
  end
  ret
end

.pathObject



14
15
16
# File 'lib/schai.rb', line 14

def self.path
  @@path ||=[]
end