c3s 0.4.10 → 0.4.11

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,7 +1,6 @@
1
1
  README.rdoc
2
2
  Rakefile
3
3
  c3s
4
- c3s.gemspec
5
4
  lib/c3s.rb
6
5
  lib/c3s_logger.rb
7
6
  lib/component.rb
data/c3s.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{c3s}
5
- s.version = "0.4.10"
5
+ s.version = "0.4.11"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ricardo Otero"]
9
9
  s.date = %q{2011-03-09}
10
- s.description = %q{C3S 0.4.10 - Library to make context entities on C3S project.}
10
+ s.description = %q{C3S 0.4.11 - Library to make context entities on C3S project.}
11
11
  s.email = %q{oterosantos@gmail.com}
12
12
  s.extra_rdoc_files = ["README.rdoc", "lib/c3s.rb", "lib/c3s_logger.rb", "lib/component.rb", "lib/component_connection.rb", "lib/configreader.rb", "lib/databaseadapter.rb", "lib/model.rb", "lib/pubsub/node.rb", "lib/pubsub/nodetracker.rb", "lib/pubsub/publisher.rb", "lib/pubsub/subscriber.rb", "lib/republisher.rb", "lib/version.rb"]
13
13
  s.files = ["README.rdoc", "Rakefile", "c3s", "c3s.gemspec", "lib/c3s.rb", "lib/c3s_logger.rb", "lib/component.rb", "lib/component_connection.rb", "lib/configreader.rb", "lib/databaseadapter.rb", "lib/model.rb", "lib/pubsub/node.rb", "lib/pubsub/nodetracker.rb", "lib/pubsub/publisher.rb", "lib/pubsub/subscriber.rb", "lib/republisher.rb", "lib/version.rb", "Manifest"]
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{c3s}
18
18
  s.rubygems_version = %q{1.4.1}
19
- s.summary = %q{C3S 0.4.10 - Library to make context entities on C3S project.}
19
+ s.summary = %q{C3S 0.4.11 - Library to make context entities on C3S project.}
20
20
 
21
21
  if s.respond_to? :specification_version then
22
22
  s.specification_version = 3
data/lib/model.rb CHANGED
@@ -1,11 +1,13 @@
1
1
  require 'active_record'
2
2
 
3
- module C3sModel
3
+ module C3sModel
4
4
  def self.included(base)
5
5
  if !base.ancestors.include?(ActiveRecord::Base)
6
6
  base.class_eval do
7
7
  cattr_accessor :attrs
8
8
  def attributes
9
+ # <published> element assumed as being present no need to add this in your
10
+ # models via "attribute" method.
9
11
  attr_hash = {}
10
12
  attrs.each do |a|
11
13
  attr_hash[a.to_s] = self.send(a.to_s) if self.respond_to?(a.to_s)
@@ -22,13 +24,17 @@ module C3sModel
22
24
  end
23
25
  end
24
26
  base.extend(ClassMethods)
27
+ # auto-add the published attribute
28
+ base.attribute :published
25
29
  end
26
30
 
27
31
  module ClassMethods
28
- def attribute(attribute)
32
+ def attribute(*attributes)
29
33
  self.attrs ||= []
30
- self.attrs << attribute.to_s
31
- attr_accessor attribute
34
+ attributes.each do |a|
35
+ self.attrs << a.to_s
36
+ attr_accessor a
37
+ end
32
38
  end
33
39
  end
34
40
 
@@ -36,9 +42,6 @@ module C3sModel
36
42
  # Attributes ignored and not included on model xml by default
37
43
  IGNORE_ATTR = ["created_at", "updated_at", "id", "jid"]
38
44
 
39
- def is_AR?
40
- end
41
-
42
45
  ##
43
46
  # Updates multiple attributes at once
44
47
  # attributes:: [Hash] the attributes hash
@@ -136,7 +136,11 @@ module C3s
136
136
  # Checks if the xml data has a <published> tag
137
137
  # xml:: [REXML::Element] content xml
138
138
  def has_publish_date(xml)
139
- return xml.first_element("published")
139
+ puts "ROOT: #{xml.root.inspect}"
140
+ puts "PUBLISHED: #{xml.get_elements("//published")}"
141
+ xml.each_element {|el| puts "> #{el.inspect}"}
142
+ el = xml.root.get_elements("//published")
143
+ el.size > 0
140
144
  end
141
145
  end
142
146
  end
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@ module C3s
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 10
5
+ TINY = 11
6
6
 
7
7
  VERSION = [MAJOR, MINOR, TINY].join('.')
8
8
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c3s
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 10
10
- version: 0.4.10
9
+ - 11
10
+ version: 0.4.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ricardo Otero
@@ -19,7 +19,7 @@ date: 2011-03-09 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
22
- description: C3S 0.4.10 - Library to make context entities on C3S project.
22
+ description: C3S 0.4.11 - Library to make context entities on C3S project.
23
23
  email: oterosantos@gmail.com
24
24
  executables: []
25
25
 
@@ -98,6 +98,6 @@ rubyforge_project: c3s
98
98
  rubygems_version: 1.4.1
99
99
  signing_key:
100
100
  specification_version: 3
101
- summary: C3S 0.4.10 - Library to make context entities on C3S project.
101
+ summary: C3S 0.4.11 - Library to make context entities on C3S project.
102
102
  test_files: []
103
103