middleman-data_model 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
1
  module Middleman
2
2
  module DataModel
3
3
 
4
- class SimpleDataModel < OpenStruct
4
+ class SimpleDataModel
5
+
5
6
  def self.all
6
7
  @data.map {|item| new item }
7
8
  end
@@ -21,6 +22,19 @@ module Middleman
21
22
  def self.models
22
23
  @models ||= []
23
24
  end
25
+
26
+
27
+ def initialize(params = {})
28
+ params.each do |key,value|
29
+ instance_variable_set("@#{key}",value)
30
+
31
+ next if respond_to? key
32
+
33
+ self.class.send :define_method, key do
34
+ instance_variable_get("@#{key}")
35
+ end
36
+ end
37
+ end
24
38
  end
25
39
 
26
40
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module DataModel
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-data_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-25 00:00:00.000000000 Z
12
+ date: 2013-03-02 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Adds simple model support to Middleman.
15
15
  email:
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project:
51
- rubygems_version: 1.8.24
51
+ rubygems_version: 1.8.25
52
52
  signing_key:
53
53
  specification_version: 3
54
54
  summary: Middleman has data, but it isn't modeled. Modeling it should be easy. This