Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jbe-Nest

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jbe-Nest

  • 1.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

h1. Nest

h2. YAML file tree object wrapper in Ruby

Nest is an object wrapper for mounting and reading data from trees of multiple YAML files. You may think of it as a mapping between files and objects. While this may reek of meta (shrug), it it does real world® usage.

h3. Installation

@gem sources -a http://gems.github.com@ if you haven't already. @sudo gem install jbe-nest@

h2. Explaination and usage

The nest data model has:

  • A mount point in some file system
  • A corresponding root node
  • Zero or more ascending nodes

Every node has:

  • Any number of properties (described in YAML)
  • Zero or more ascending files

I wrote nest as a file based data model for a website, where every node corresponded to a viewable page, and aditional contents was kept in files.

This is an example of a mountable nest directory structure:


doc/
  index.yml
  about.yml
  blob.file
  fruits/
    index.yml
    apple.yml
    banana/
      index.yml
      banana.jpg

This gives the following tree of nodes, excluding files:


/
  about
  fruits
    apple
    banana

The @root@ node also contains @blob.file@, and @banana@ also contains @banana.jpg@. All of this is available in the object model. Every node contains it's own YAML.

Every node will have a uri corresponding to it's path in the above tree, such as @/fruits/banana@. This is useful when you need urls.

h3. Synopsis


class Library
   include Nest
   mount './doc'
end

l = Library.root

l.properties  # available methods
l.children
l.parent
l.files


h2. Why is this useful?

For highly customizeable, file based taxonomies, ie. websites. Let each *.yaml correspond to a page, and contain metainformation, including styles and layout instructions. Keep additional content in files, in accordance with that particular implementation.

h3. TODO

  • Write tests

h3. LICENSE

(MIT License)

Copyright (c) 2009 Jostein Berre Eliassen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

FAQs

Package last updated on 11 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc