string_date_accessors 0.0.0 → 0.0.1

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.
data/README.rdoc CHANGED
@@ -1,6 +1,43 @@
1
1
  = string_date_accessors
2
2
 
3
- Description goes here.
3
+ Get and set dates as strings on ActiveRecord-like objects.
4
+
5
+ This gem is useful if you don't want to use Rails' standard date helpers and would rather
6
+ set a text format for reading and writing dates.
7
+
8
+ == Usage
9
+
10
+ require 'rubygems'
11
+ require 'ostruct'
12
+ require 'string_date_accessors'
13
+
14
+ StringDateAccessors.format = '%d/%m/%y'
15
+
16
+ class Lady < OpenStruct
17
+ include StringDateAccessors
18
+ string_date_accessors :birthday, :dying_day
19
+ end
20
+
21
+ thatcher = Lady.new
22
+
23
+ thatcher.birthday = '10/1/09'
24
+
25
+ puts thatcher.birthday.day
26
+ puts thatcher.birthday.month
27
+ puts thatcher.birthday.year
28
+
29
+ thatcher.dying_day = 'not dead yet'
30
+
31
+ puts thatcher.dying_day
32
+ puts thatcher.invalid_date_accessors.inspect
33
+
34
+ === The above outputs:
35
+
36
+ 10
37
+ 1
38
+ 2009
39
+ not dead yet
40
+ [:dying_day]
4
41
 
5
42
  == Note on Patches/Pull Requests
6
43
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -27,10 +27,6 @@ module StringDateAccessors
27
27
  end
28
28
 
29
29
  module ClassMethods
30
- def format
31
- StringDateAccessors.format
32
- end
33
-
34
30
  def string_date_accessors(*attributes)
35
31
  attributes.each do |attribute|
36
32
  define_method "#{attribute}=" do |input|
@@ -0,0 +1,58 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{string_date_accessors}
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Andrew Bruce"]
12
+ s.date = %q{2009-12-30}
13
+ s.description = %q{
14
+ This gem is useful if you don't want to use Rails' standard date helpers and would rather
15
+ set a text format for reading and writing dates.
16
+ }
17
+ s.email = %q{andrew@camelpunch.com}
18
+ s.extra_rdoc_files = [
19
+ "LICENSE",
20
+ "README.rdoc"
21
+ ]
22
+ s.files = [
23
+ ".document",
24
+ ".gitignore",
25
+ "LICENSE",
26
+ "README.rdoc",
27
+ "Rakefile",
28
+ "VERSION",
29
+ "lib/string_date_accessors.rb",
30
+ "spec/spec.opts",
31
+ "spec/spec_helper.rb",
32
+ "spec/string_date_accessors_spec.rb",
33
+ "string_date_accessors.gemspec"
34
+ ]
35
+ s.homepage = %q{http://github.com/camelpunch/string_date_accessors}
36
+ s.rdoc_options = ["--charset=UTF-8"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = %q{1.3.5}
39
+ s.summary = %q{Get and set dates as strings on ActiveRecord-like objects}
40
+ s.test_files = [
41
+ "spec/spec_helper.rb",
42
+ "spec/string_date_accessors_spec.rb"
43
+ ]
44
+
45
+ if s.respond_to? :specification_version then
46
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
+ s.specification_version = 3
48
+
49
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
51
+ else
52
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
56
+ end
57
+ end
58
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_date_accessors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bruce
@@ -42,6 +42,7 @@ files:
42
42
  - spec/spec.opts
43
43
  - spec/spec_helper.rb
44
44
  - spec/string_date_accessors_spec.rb
45
+ - string_date_accessors.gemspec
45
46
  has_rdoc: true
46
47
  homepage: http://github.com/camelpunch/string_date_accessors
47
48
  licenses: []