braise 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWU5YmJkNWVhYzFmZjc2ODExZWMxOGI4MTAyYWExNzA5MTk4NDA0MQ==
4
+ YWJlNzI3NDVlNjU4MjY3YmE2Yzk5Y2Q2MzFlZDJkMmJhYjYzNGE1MA==
5
5
  data.tar.gz: !binary |-
6
- MDFmZGMyMWFmYjI0ZjJlZTA1MmZkNDNhMzNjNGY1NjU4MmVlNDYyNw==
6
+ NDgzODFiZGMwNDQ3ODQwMjBkMmMxZWRhNTBmMTM5ZmQxODA3ZjA5MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjljOTQ3YTViMWQ1MmJhYTk1MGRkZGM4ZDY1OWZlMzc4NTU0YTk5ZmU0Mjcy
10
- MDQzNGFlMTlkMzBhMTI1MWU0ODBjYWI3NWYyNGU4MjY3MGQwM2RjZWNlMDgz
11
- YWE2YzlkM2Y1Y2NjNTUzMjk5MWZiMzljNzk2MTg0MGFiYjQ2MTQ=
9
+ Zjc4ODdjNDI1MjZiOWI4NDdkYWE4MDNlMzllODZkMTlmMDQ5NmM3MjRhNDFk
10
+ Mzg0NWI0NDkxODM0YWQ0ODYwNWMzNjlhMDJiYTM2Y2QzNTk4ODgwZjJjOTI2
11
+ NjMxZTRkNTQ0OTMwN2Q2NDQwYTJjZmZiYjhmNmFkZjBiMTU5YzA=
12
12
  data.tar.gz: !binary |-
13
- MzM2ZTEzOTE4ODk5MzMwOWExODVmNDY0ZGI4MWExMWIxMmIxODYwNWNhOWY3
14
- NjE0M2E1NjA4NGRlM2EwMDg0YWZjNTFlMTIxYmI0Y2NlNWY1ZTZiMmY5MWY5
15
- NGI5NjZmMzYxZDg1Y2M2ODg0YmEwYzdlMWRkMjhkNjgxMTgyYjM=
13
+ N2E4OTliZDBmNDBhODI1NDdlNTFmNGYwNDQ3MGQ4MWUxYWJkNDcyYmNjMDkx
14
+ MGIzNjljOTY4NDAyZmI2ZTAwMDUzODBiOGQxMWIxNmZhNjVlYjI1MDBjMjIz
15
+ YThiYjNiMDkwYzI4MzIwNjhiMDI3Y2U2YTA2YjkzMjA1YTYwNmY=
data/braise.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Alex Lau"]
10
10
  spec.description = "Better raise for ruby"
11
11
  spec.summary = "Add extra options to ruby's raise method."
12
- spec.homepage = ""
12
+ spec.homepage = "https://github.com/MrAlexLau/braise"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
@@ -19,4 +19,5 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
21
21
  spec.add_development_dependency "rake"
22
+ spec.add_dependency "ansi"
22
23
  end
@@ -0,0 +1,8 @@
1
+ require 'braise'
2
+ require 'ansi'
3
+ include Braise
4
+
5
+ arr = [1, 2, 3]
6
+
7
+ Braise.configure({:color => ANSI.on_green})
8
+ braise arr
@@ -1,3 +1,3 @@
1
1
  module Braise
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/braise.rb CHANGED
@@ -1,8 +1,26 @@
1
1
  require "braise/version"
2
+ require "ansi"
2
3
 
3
4
  module Braise
4
- def braise(obj, opts=nil)
5
- raise obj.inspect
5
+ @@config = { :color => ANSI.white_on_red,
6
+ :additional_flags => "" }
7
+
8
+ @@valid_config_keys = @@config.keys
9
+
10
+ def braise(obj, opts={})
11
+ opts_str = stringify_options(@@config.merge(opts))
12
+
13
+ raise (opts_str + obj.inspect + ANSI.clear)
14
+ end
15
+
16
+ def configure(opts={})
17
+ opts.each {|k,v| @@config[k.to_sym] = v if @@valid_config_keys.include? k.to_sym}
18
+ end
19
+
20
+ private
21
+
22
+ def stringify_options(opts_hash)
23
+ return opts_hash.inject(""){|result, pair| result.to_s + " " + pair[1].to_s}.strip
6
24
  end
7
25
 
8
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Lau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-28 00:00:00.000000000 Z
11
+ date: 2013-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ansi
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Better raise for ruby
42
56
  email:
43
57
  executables: []
@@ -50,9 +64,10 @@ files:
50
64
  - README.md
51
65
  - Rakefile
52
66
  - braise.gemspec
67
+ - example/example.rb
53
68
  - lib/braise.rb
54
69
  - lib/braise/version.rb
55
- homepage: ''
70
+ homepage: https://github.com/MrAlexLau/braise
56
71
  licenses:
57
72
  - MIT
58
73
  metadata: {}