sugarcrm 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/sugarcrm.rb +0 -1
- data/lib/sugarcrm/core_ext/attribute.rb +67 -0
- data/lib/sugarcrm/core_ext/remove_method.rb +6 -0
- data/lib/sugarcrm/core_ext/singleton_class.rb +13 -0
- data/lib/sugarcrm/request.rb +2 -1
- metadata +11 -7
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ begin
|
|
14
14
|
gem.authors = ["Carl Hicks"]
|
15
15
|
gem.add_development_dependency "shoulda", ">= 0"
|
16
16
|
gem.add_dependency "json", ">= 0"
|
17
|
-
gem.add_dependency "activesupport", ">=
|
17
|
+
gem.add_dependency "activesupport", ">= 2.3"
|
18
18
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
19
19
|
end
|
20
20
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.2
|
data/lib/sugarcrm.rb
CHANGED
@@ -0,0 +1,67 @@
|
|
1
|
+
#require 'singleton_class'
|
2
|
+
#require 'remove_method'
|
3
|
+
|
4
|
+
class Class
|
5
|
+
# Declare a class-level attribute whose value is inheritable and
|
6
|
+
# overwritable by subclasses:
|
7
|
+
#
|
8
|
+
# class Base
|
9
|
+
# class_attribute :setting
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# class Subclass < Base
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# Base.setting = true
|
16
|
+
# Subclass.setting # => true
|
17
|
+
# Subclass.setting = false
|
18
|
+
# Subclass.setting # => false
|
19
|
+
# Base.setting # => true
|
20
|
+
#
|
21
|
+
# This matches normal Ruby method inheritance: think of writing an attribute
|
22
|
+
# on a subclass as overriding the reader method.
|
23
|
+
#
|
24
|
+
# For convenience, a query method is defined as well:
|
25
|
+
#
|
26
|
+
# Subclass.setting? # => false
|
27
|
+
#
|
28
|
+
# Instances may overwrite the class value in the same way:
|
29
|
+
#
|
30
|
+
# Base.setting = true
|
31
|
+
# object = Base.new
|
32
|
+
# object.setting # => true
|
33
|
+
# object.setting = false
|
34
|
+
# object.setting # => false
|
35
|
+
# Base.setting # => true
|
36
|
+
#
|
37
|
+
# To opt out of the instance writer method, pass :instance_writer => false.
|
38
|
+
#
|
39
|
+
# object.setting = false # => NoMethodError
|
40
|
+
def class_attribute(*attrs)
|
41
|
+
instance_writer = !attrs.last.is_a?(Hash) || attrs.pop[:instance_writer]
|
42
|
+
|
43
|
+
attrs.each do |name|
|
44
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
45
|
+
def self.#{name}() nil end
|
46
|
+
def self.#{name}?() !!#{name} end
|
47
|
+
|
48
|
+
def self.#{name}=(val)
|
49
|
+
singleton_class.class_eval do
|
50
|
+
remove_possible_method(:#{name})
|
51
|
+
define_method(:#{name}) { val }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def #{name}
|
56
|
+
defined?(@#{name}) ? @#{name} : singleton_class.#{name}
|
57
|
+
end
|
58
|
+
|
59
|
+
def #{name}?
|
60
|
+
!!#{name}
|
61
|
+
end
|
62
|
+
RUBY
|
63
|
+
|
64
|
+
attr_writer name if instance_writer
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Kernel
|
2
|
+
# Returns the object's singleton class.
|
3
|
+
def singleton_class
|
4
|
+
class << self
|
5
|
+
self
|
6
|
+
end
|
7
|
+
end unless respond_to?(:singleton_class) # exists in 1.9.2
|
8
|
+
|
9
|
+
# class_eval on an object acts like singleton_class.class_eval.
|
10
|
+
def class_eval(*args, &block)
|
11
|
+
singleton_class.class_eval(*args, &block)
|
12
|
+
end
|
13
|
+
end
|
data/lib/sugarcrm/request.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugarcrm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Carl Hicks
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-09 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -54,10 +54,11 @@ dependencies:
|
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
hash:
|
57
|
+
hash: 5
|
58
58
|
segments:
|
59
|
-
-
|
60
|
-
|
59
|
+
- 2
|
60
|
+
- 3
|
61
|
+
version: "2.3"
|
61
62
|
type: :runtime
|
62
63
|
version_requirements: *id003
|
63
64
|
description: |-
|
@@ -105,6 +106,9 @@ files:
|
|
105
106
|
- lib/sugarcrm/api/set_relationship.rb
|
106
107
|
- lib/sugarcrm/api/set_relationships.rb
|
107
108
|
- lib/sugarcrm/connection.rb
|
109
|
+
- lib/sugarcrm/core_ext/attribute.rb
|
110
|
+
- lib/sugarcrm/core_ext/remove_method.rb
|
111
|
+
- lib/sugarcrm/core_ext/singleton_class.rb
|
108
112
|
- lib/sugarcrm/exceptions.rb
|
109
113
|
- lib/sugarcrm/module.rb
|
110
114
|
- lib/sugarcrm/request.rb
|