Code Monkey home page Code Monkey logo

qstate's Introduction

Qstate

Qstate attempts to provide an easy way to keep all of your applications state information, basically the URL-Parameters, in one place.

It does so by providing different classes for different types of parameters (called plugins) like:

  • Date/DateTime
  • Rails parameters (action, controller)
  • Query parameters (database where parameters)
  • MapReduce parameters
  • Confidential parameters (user name, pub/priv key)
  • View parameters (similar to Rails, but not specific for rails)

QState will serialize/deserialize it's stored information as/from

  • String (URL)
  • Hash or
  • JSON

Overview

The FilterModel (find a better name) is the organizing model. It knows about all configured plugins and creates dynamic setters and getters for them.

Create a new FilterModel

qstate = Qstate::Filtermodel.new

Add values

qstate.view.add_value(:key, "value")
qstate.view.add_value(:key1, "value1")
qstate.query.add_value(:key2, :value2")

Now you serialize this information for example in URI format with:

uri = qstate.uri

and you can then transform this URI back into a Filtermodel by doing

qstate2 = Qstate::Filermodel.new(uri)

The parameters in the uri will be prefixed with a the following two characters:

  • Rails : '' (Rails parameters are not prefixed, so that those params can be used in rails and within qstate)
  • Date/DateTime: 't_'
  • View: 'v_'
  • Query: 'q_'
  • Confidential: '' (Confidential objects can not be serialized and have therefore no prefix)
  • MapReduce: 'm_'

Extensibility

Qstate is designed around the principle that I don't know what you need. Therefore, Qstate can be configured in such a way that only those you need, are available. Currently the complete codebase is loaded, but this will change in further releases as well.

If there is the need for a new plugin, it is easily written and integrated without having to interact with other plugins.

Development

Clone the repo

$ git clone [email protected]:QEDio/qstate.git

Update submodules

$ git submodule init && git submodule update

Install dependencies

$ bundle install

Run the tests

$ rake 

qstate's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.