fompila 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9724a04250a6bd7e621bbb957dc32ab80370a044
4
- data.tar.gz: 7a3f6f357b5b94876320872993398c1c87c3e7c9
3
+ metadata.gz: 21ce625d856db8bea1492589de132c7a81ca1fc7
4
+ data.tar.gz: 8ce39bf46bc94835c7c9f3d92d60d977fa522bbb
5
5
  SHA512:
6
- metadata.gz: 223466645a739a2688468e84bb86e9d17e2cf22e598fe91567d13921cf12fab7addfbbae852829174d19be62a423688a94586dbcd1f0330492ab5fe9f69fe8df
7
- data.tar.gz: e6ce45de535e42e7ecf562dabd88eaa0484e9be6b4804d34f78d41c82332016698733c92c17c09ae6e5e26af34c5c51dcecab8f0f060c0d96a9a2bb6c284bb33
6
+ metadata.gz: 89bf6746b08af04fabfff81b2fd803658e2efaef70ae593f04059437762a8bd1b9257c0a6bd0537d269515f78d2e3bfc9724537e353a0ef0e9f6293eb2707662
7
+ data.tar.gz: 08e4520f18597478c0d7b19927aba5a9658f2dfafb8acc71b14577d7953b8745801186be0d250e1a77e1067b97387023b85ec12989684769756e3bead8283c33
@@ -0,0 +1,15 @@
1
+ module Kernel
2
+ alias :original_puts :puts
3
+
4
+ def puts(args)
5
+ config = Fompila::Configuration.instance
6
+ message = args
7
+ if config.prepend?
8
+ prepend = config.message || 'FOMPILA'
9
+ message = "#{prepend} #{args}"
10
+ end
11
+
12
+ original_puts message
13
+ end
14
+ end
15
+
@@ -1,8 +1,7 @@
1
- module Kernel
2
- alias :original_puts :puts
1
+ require 'ext/kernel'
2
+ require 'fompila/configuration'
3
3
 
4
- def puts(args)
5
- original_puts "FOMPILA #{args}"
6
- end
4
+ Fompila::Configuration.configure do |config|
5
+ config.prepend = true
7
6
  end
8
7
 
@@ -0,0 +1,18 @@
1
+ require 'singleton'
2
+
3
+ module Fompila
4
+ class Configuration
5
+ include Singleton
6
+
7
+ attr_accessor :message, :prepend
8
+
9
+ def self.configure
10
+ yield Fompila::Configuration.instance if block_given?
11
+ end
12
+
13
+ def prepend?
14
+ prepend == "true" || prepend == true
15
+ end
16
+ end
17
+ end
18
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fompila
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Maringolo
@@ -17,6 +17,8 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/fompila.rb
20
+ - lib/ext/kernel.rb
21
+ - lib/fompila/configuration.rb
20
22
  homepage:
21
23
  licenses: []
22
24
  metadata: {}