class Middleman::DataModel::SimpleDataModel
Public Class Methods
all()
click to toggle source
# File lib/middleman-data_model/simple_data_model.rb, line 6 def self.all @data.map {|item| new item } end
data=(data)
click to toggle source
# File lib/middleman-data_model/simple_data_model.rb, line 14 def self.data=(data) @data = data end
data_name()
click to toggle source
# File lib/middleman-data_model/simple_data_model.rb, line 10 def self.data_name @data_name ? @data_name : self.to_s.downcase.pluralize end
inherited(base)
click to toggle source
# File lib/middleman-data_model/simple_data_model.rb, line 18 def self.inherited(base) models << base end
models()
click to toggle source
# File lib/middleman-data_model/simple_data_model.rb, line 22 def self.models @models ||= [] end
new(params = {})
click to toggle source
# File lib/middleman-data_model/simple_data_model.rb, line 27 def initialize(params = {}) params.each do |key,value| instance_variable_set("@#{key}",value) next if respond_to? key self.class.send :define_method, key do instance_variable_get("@#{key}") end end end