Sha256: 7e97db13f5e1731f94e04c8cf934ed2be82006b1ed2b0a0aa9fcc3fa6838e78c
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require 'active_model' require 'hibachi/recipe' require 'hibachi/persistence' require 'hibachi/provisioning' require 'hibachi/querying' module Hibachi # A Rails model backend for describing machine configuration and # exposing such configuration to manipulation by the end user. # Hibachi::Model is subclassed like an ActiveRecord::Base, you define # attributes on the class that map to attributes in each model's JSON # representation. class Model include ActiveModel::Model include Recipe include Persistence include Provisioning extend Querying # Store all attributes in this Hash. attr_reader :attributes # Set attributes to the main collector before assigning them to # methods. def initialize(from_attrs={}) @attributes = from_attrs super end # The JSON representation of each Model object is simply its # attributes exposed as JSON. def to_json(*arguments) @json ||= attributes.to_json end protected def config Hibachi.config end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hibachi-0.0.1 | lib/hibachi/model.rb |
hibachi-0.0.1.pre | lib/hibachi/model.rb |