Module: Anvil::Helpers
Instance Method Summary collapse
- #anvil_metadata_dir(root) ⇒ Object
- #is_url?(string) ⇒ Boolean
- #json_decode(str) ⇒ Object
- #json_encode(obj) ⇒ Object
- #read_anvil_metadata(root, name) ⇒ Object
- #write_anvil_metadata(root, name, data) ⇒ Object
Instance Method Details
#anvil_metadata_dir(root) ⇒ Object
14 15 16 17 18 |
# File 'lib/anvil/helpers.rb', line 14 def (root) dir = File.join(root, ".anvil") FileUtils.mkdir_p(dir) dir end |
#is_url?(string) ⇒ Boolean
20 21 22 |
# File 'lib/anvil/helpers.rb', line 20 def is_url?(string) URI.parse(string).scheme rescue nil end |
#json_decode(str) ⇒ Object
10 11 12 |
# File 'lib/anvil/helpers.rb', line 10 def json_decode(str) Anvil::OkJson.decode(str) end |
#json_encode(obj) ⇒ Object
6 7 8 |
# File 'lib/anvil/helpers.rb', line 6 def json_encode(obj) Anvil::OkJson.encode(obj) end |