module Bricolage::EmbeddedCodeAPI

Private Instance Methods

all_tables() click to toggle source
# File lib/bricolage/embeddedcodeapi.rb, line 41
def all_tables
  Dir.glob("#{app_home}/*/*.ct").map {|path|
    SQLStatement.new(FileResource.new(path))
  }
end
app_home_relative_path(rel) click to toggle source
# File lib/bricolage/embeddedcodeapi.rb, line 16
def app_home_relative_path(rel)
  app_home + rel
end
attribute_tables(attr) click to toggle source
# File lib/bricolage/embeddedcodeapi.rb, line 37
def attribute_tables(attr)
  all_tables.select {|table| table.attributes.include?(attr) }
end
date(str) click to toggle source
# File lib/bricolage/embeddedcodeapi.rb, line 29
def date(str)
  Date.parse(str)
end
read_file_if_exist(path) click to toggle source
# File lib/bricolage/embeddedcodeapi.rb, line 24
def read_file_if_exist(path)
  return nil unless File.exist?(path)
  File.read(path)
end
relative_path(rel) click to toggle source
# File lib/bricolage/embeddedcodeapi.rb, line 20
def relative_path(rel)
  base_dir + rel
end
user_home() click to toggle source
# File lib/bricolage/embeddedcodeapi.rb, line 8
def user_home
  Pathname(ENV['HOME'])
end
user_home_relative_path(rel) click to toggle source
# File lib/bricolage/embeddedcodeapi.rb, line 12
def user_home_relative_path(rel)
  user_home + rel
end
ymd(date) click to toggle source
# File lib/bricolage/embeddedcodeapi.rb, line 33
def ymd(date)
  date.strftime('%Y-%m-%d')
end