sanultari-config 0.1.0 → 0.2.0.rc.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.2.0.rc.1
@@ -40,8 +40,8 @@ module SanUltari
40
40
 
41
41
  self.class.instance_eval do
42
42
  define_method(name.to_sym) do |&blk|
43
- blk.call self[name] if blk != nil
44
- self[name]
43
+ blk.call self[name] if blk != nil
44
+ self[name]
45
45
  end if not public_methods.include? name.to_sym
46
46
 
47
47
  define_method("#{name}=".to_sym) do |value|
@@ -6,7 +6,7 @@ require 'yaml'
6
6
  module SanUltari
7
7
  # @author Jeong, Jiung
8
8
  class Config
9
- attr_accessor :name, :path
9
+ attr_accessor :name, :path, :store
10
10
 
11
11
  # 생성자
12
12
  #
@@ -92,7 +92,7 @@ module SanUltari
92
92
 
93
93
  # 존재하지 않는 메소드 처리를 위한 핸들러
94
94
  def method_missing(method_name, *args, &block)
95
- @store.send method_name, *args, &block
95
+ @store.public_send method_name, *args, &block
96
96
  end
97
97
  end
98
98
  end
@@ -0,0 +1,17 @@
1
+ # coding: utf-8
2
+ require 'sanultari/config'
3
+ require 'singleton'
4
+
5
+ module SanUltari
6
+ # Application 전역으로 쓸 수 있는 Singleton 객체
7
+ # @author Jeong, Jiung
8
+ # @see Singleton
9
+ class GlobalConfig < Config
10
+ include Singleton
11
+
12
+ # class method 접근을 singleton instance method 접근으로 변경
13
+ def self.method_missing(method_name, *args, &block)
14
+ SanUltari::GlobalConfig.instance.public_send method_name, *args, &block
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,4 @@
1
1
  module SanUltari; end
2
2
 
3
3
  require 'sanultari/config'
4
+ require 'sanultari/global_config'
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "SanUltari::Config" do
4
+ it "should have static accessor" do
5
+ SanUltari::GlobalConfig.test = 1
6
+ SanUltari::GlobalConfig.test.should eql 1
7
+ end
8
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanultari-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.2.0.rc.1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeong, Jiung
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-20 00:00:00.000000000 Z
12
+ date: 2012-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ZenTest
@@ -178,8 +178,10 @@ files:
178
178
  - lib/sanultari-config.rb
179
179
  - lib/sanultari/config.rb
180
180
  - lib/sanultari/config/store.rb
181
+ - lib/sanultari/global_config.rb
181
182
  - spec/config/store_spec.rb
182
183
  - spec/config_spec.rb
184
+ - spec/global_config_spec.rb
183
185
  - spec/spec_helper.rb
184
186
  homepage: https://github.com/sanultari/config
185
187
  licenses:
@@ -196,13 +198,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
198
  version: '0'
197
199
  segments:
198
200
  - 0
199
- hash: -539915354181194909
201
+ hash: -270335357142323998
200
202
  required_rubygems_version: !ruby/object:Gem::Requirement
201
203
  none: false
202
204
  requirements:
203
- - - ! '>='
205
+ - - ! '>'
204
206
  - !ruby/object:Gem::Version
205
- version: '0'
207
+ version: 1.3.1
206
208
  requirements: []
207
209
  rubyforge_project:
208
210
  rubygems_version: 1.8.24