daberu 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -39,9 +39,9 @@ Or install it yourself as:
39
39
  2
40
40
  3
41
41
 
42
- p a.format #=> "Class: %s, Method: %s, Arguments: [%s], Block: %s"
43
- a.format = "%s#%s(%s)"
44
- p a.format #=> "%s#%s(%s)"
42
+ p Daberu.format_get(a) #=> "Class: %s, Method: %s, Arguments: [%s], Block: %s"
43
+ Daberu.format_set(a, "%s#%s(%s)")
44
+ p Daberu.format_get(a) #=> "%s#%s(%s)"
45
45
  a << 4 #=> "Array#<<(4)"
46
46
 
47
47
  ### Ruby version
data/daberu.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["myokoym@gmail.com"]
7
7
  gem.description = %q{Create a talkative object.}
8
8
  gem.summary = %q{Create a talkative object}
9
- gem.homepage = ""
9
+ gem.homepage = "https://github.com/myokoym/daberu"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
data/lib/daberu.rb CHANGED
@@ -5,7 +5,6 @@ class Daberu
5
5
  undef_method m unless m.to_s =~ /^__|method_missing|respond_to?|object_id/
6
6
  end
7
7
 
8
- attr_accessor :format
9
8
  def initialize(obj = Object.new)
10
9
  @obj = obj
11
10
  @format = "Class: %s, Method: %s, Arguments: [%s], Block: %s"
@@ -15,5 +14,21 @@ class Daberu
15
14
  p @format % [@obj.class, name, args.to_s.gsub(/^\[|\]$/, ""), block]
16
15
  @obj.send(name, *args, &block)
17
16
  end
17
+
18
+ def self.format_get(obj)
19
+ obj.__daberu_format_get__
20
+ end
21
+
22
+ def self.format_set(obj, str)
23
+ obj.__daberu_format_set__(str)
24
+ end
25
+
26
+ def __daberu_format_get__
27
+ @format
28
+ end
29
+
30
+ def __daberu_format_set__(str)
31
+ @format = str
32
+ end
18
33
  end
19
34
 
@@ -1,3 +1,3 @@
1
1
  module Daberu
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/spec/daberu_spec.rb CHANGED
@@ -64,7 +64,7 @@ describe Daberu do
64
64
  t = Tempfile.open("daberu")
65
65
  $stdout = File.open(t, "w")
66
66
  d = Daberu.new
67
- d.format = "%s#%s(%s): %s"
67
+ Daberu.format_set(d, "%s#%s(%s): %s")
68
68
  d.class
69
69
  $stdout.flush
70
70
  $stdout = STDOUT
@@ -80,7 +80,7 @@ describe Daberu do
80
80
  d = Daberu.new
81
81
  $stdout.flush
82
82
  $stdout = STDOUT
83
- d.format.should == "Class: %s, Method: %s, Arguments: [%s], Block: %s"
83
+ Daberu.format_get(d).should == "Class: %s, Method: %s, Arguments: [%s], Block: %s"
84
84
  end
85
85
  end
86
86
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daberu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -27,7 +27,7 @@ files:
27
27
  - lib/daberu.rb
28
28
  - lib/daberu/version.rb
29
29
  - spec/daberu_spec.rb
30
- homepage: ''
30
+ homepage: https://github.com/myokoym/daberu
31
31
  licenses: []
32
32
  post_install_message:
33
33
  rdoc_options: []