custom-attributes 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -57,6 +57,10 @@ class ActiveRecord::CustomAttributes::CustomAttributeList
57
57
  attribute.internal_label = internal_label
58
58
  end
59
59
 
60
+ def attributes_of_type(type)
61
+ loaded_attributes.select { |i| i.type == type.to_sym }
62
+ end
63
+
60
64
  private
61
65
 
62
66
  attr_reader :defined_attributes, :extra_attribute_types, :record
@@ -98,10 +102,6 @@ class ActiveRecord::CustomAttributes::CustomAttributeList
98
102
  I18n.t(internal_name, :scope => translate_scope, :default => defaults)
99
103
  end
100
104
 
101
- def get_attributes_of_type(type)
102
- loaded_attributes.select { |i| i.type == type }
103
- end
104
-
105
105
  def get_value_of(type, internal_label)
106
106
  found = get_attribute(type, internal_label)
107
107
  found.value if found
@@ -122,7 +122,7 @@ class ActiveRecord::CustomAttributes::CustomAttributeList
122
122
  end
123
123
 
124
124
  define_method "#{key}_attributes" do
125
- get_attributes_of_type(key.to_sym)
125
+ attributes_of_type(key.to_sym)
126
126
  end
127
127
 
128
128
  define_method "#{key}_value_of" do |internal_name|
@@ -83,7 +83,6 @@ describe "Custom attributes of a person" do
83
83
  @person.custom_attributes.defined_labels_for(:date).should =~ ["Born on", "Wed on", "Died on"]
84
84
  end
85
85
 
86
-
87
86
  end
88
87
 
89
88
  describe "Custom attributes of a product" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom-attributes
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthijs Groen