Module: Mumukit::Sync::Store::Github::WithFileReading

Included in:
GuideReader
Defined in:
lib/mumukit/sync/store/github/with_file_reading.rb

Instance Method Summary collapse

Instance Method Details

#read_code_file(root, filename) ⇒ Object



5
6
7
8
9
# File 'lib/mumukit/sync/store/github/with_file_reading.rb', line 5

def read_code_file(root, filename)
  files = Dir.glob("#{root}/#{filename}.*")
  file = files[0]
  read_file(file) if files.length == 1
end

#read_file(path) ⇒ Object



15
16
17
# File 'lib/mumukit/sync/store/github/with_file_reading.rb', line 15

def read_file(path)
  File.read(path) if path && File.exist?(path)
end

#read_yaml_file(path) ⇒ Object



11
12
13
# File 'lib/mumukit/sync/store/github/with_file_reading.rb', line 11

def read_yaml_file(path)
  YAML.load_file(path) if path && File.exist?(path)
end