rbcss 0.1.0 → 0.1.1

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: c8f0b828893535a4825691f879d38dbb81c8e742
4
- data.tar.gz: 20ef37044748c197e9f89d0520aa9ddca550e20b
3
+ metadata.gz: a4c7c8dc6d39f6c2be63198661d6a3b82835b101
4
+ data.tar.gz: b6e7165da7cda9fb9325f8588ec56658f1b082aa
5
5
  SHA512:
6
- metadata.gz: d6f971cff23c305b0c61ad0c524b1041339c6cf3681d660a5de9b4332d6bc1e8d2de04b5003d9c5079fc563fd051dba5a84913dfab38e8bd879cfc2f37ffb86b
7
- data.tar.gz: 98ea24e00b3239c62a1c3f8a06d3e4bc0fed8efd9b5a4ac82a119954d0835f81303c9db7513fc5585b3eea3dc6aaec12b4b92a144c0f4e588844f39ef38dc17e
6
+ metadata.gz: 5d90953b4b582331c5794f55ad2566e4902f49d94c09b7afd0f487647f72c43fd44867f0158bab2a799e94cac6c2f6d72392431647175cafcd97bbebac775b50
7
+ data.tar.gz: 25fe4f90501fd0ade6f490345b5c5d13eb3e6952da5c3ee958cdc439ecfa593a479bc323878848f0b37a171858efd2e5280a37fb1be9180915f21d3ebcd322dc
data/lib/css.rb CHANGED
@@ -1,26 +1,26 @@
1
- module CSS
1
+ class CSS
2
2
 
3
- # Send a message to the module_eval method of CSS module. It is just an Alias.
4
- # @param &block [Proc] the code block to be executed in the CSS context
5
- def self.style &block
6
- send :module_eval, &block
3
+ # Send a message to the instance_eval method of a CSS instace. It is just an Alias.
4
+ # @param &block [Proc] the code block to be executed in the CSS instance context
5
+ def style &block
6
+ send :instance_eval, &block
7
7
  end
8
8
 
9
9
  # Write a css selector declaration to $stdout
10
10
  # @param selector [String] the selector name or string
11
- def self.selector selector, &block
11
+ def selector selector, &block
12
12
  $stdout.write "#{selector}{"; yield; $stdout.write "}"
13
13
  end
14
14
 
15
15
  # Write a css property declaration with the name of the called method
16
16
  # @param method [Symbol] the called method name as a symbol
17
- def self.property method, *args, &block
17
+ def property method, *args, &block
18
18
  $stdout.write "#{method.to_s.gsub('_', '-')}:#{args[0]};"
19
19
  end
20
20
 
21
21
  private
22
22
 
23
- def self.method_missing name, *args, &block
23
+ def method_missing name, *args, &block
24
24
  send(:selector, *args, &block) if block
25
25
  send(:property, name, *args, &block) if args[0] and !block
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module Rbcss
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["ivan.eng.controle@gmail.com"]
11
11
  spec.summary = %q{A Ruby DSL to generate css.}
12
12
  spec.description = %q{This command line application generates css stylesheets from a Ruby DSL code.}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/ivanom/rbcss"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -1,10 +1,11 @@
1
1
  require "css"
2
2
 
3
- RSpec.describe CSS, :type => :module do
3
+ RSpec.describe CSS, :type => :class do
4
+ let(:css) { CSS.new }
4
5
  describe "#style" do
5
6
  it "calls module_eval method" do
6
- expect(CSS).to receive(:module_eval)
7
- CSS.style do
7
+ expect(css).to receive(:instance_eval)
8
+ css.style do
8
9
  end
9
10
  end
10
11
  end
@@ -12,7 +13,7 @@ RSpec.describe CSS, :type => :module do
12
13
  describe "#property" do
13
14
  it "prints a css property declaration to $stdout" do
14
15
  expect{
15
- CSS.style do
16
+ css.style do
16
17
  property "color", "green"
17
18
  end
18
19
  }.to output("color:green;").to_stdout
@@ -22,7 +23,7 @@ RSpec.describe CSS, :type => :module do
22
23
  describe "#selector" do
23
24
  it "prints a css selector declaration to $stdout" do
24
25
  expect{
25
- CSS.style do
26
+ css.style do
26
27
  selector("body"){}
27
28
  end
28
29
  }.to output("body{}").to_stdout
@@ -30,7 +31,7 @@ RSpec.describe CSS, :type => :module do
30
31
 
31
32
  it "yields to a block with properties declarations" do
32
33
  expect{
33
- CSS.style do
34
+ css.style do
34
35
  selector("body"){
35
36
  color "green"
36
37
  }
@@ -43,7 +44,7 @@ RSpec.describe CSS, :type => :module do
43
44
  context "with an argument and a block" do
44
45
  it "prints a css selector declaration to $stdout" do
45
46
  expect{
46
- CSS.style do
47
+ css.style do
47
48
  to("body"){}
48
49
  end
49
50
  }.to output("body{}").to_stdout
@@ -53,7 +54,7 @@ RSpec.describe CSS, :type => :module do
53
54
  context "with just an argument" do
54
55
  it "prints a css property declaration to $stdout" do
55
56
  expect{
56
- CSS.style do
57
+ css.style do
57
58
  to "body"
58
59
  end
59
60
  }.to output("to:body;").to_stdout
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbcss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-23 00:00:00.000000000 Z
11
+ date: 2015-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cucumber
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: aruba
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.1'
83
83
  description: This command line application generates css stylesheets from a Ruby DSL
@@ -88,7 +88,7 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - ".gitignore"
91
+ - .gitignore
92
92
  - Gemfile
93
93
  - LICENSE.txt
94
94
  - README.md
@@ -100,7 +100,7 @@ files:
100
100
  - lib/rbcss/version.rb
101
101
  - rbcss.gemspec
102
102
  - spec/css_spec.rb
103
- homepage: ''
103
+ homepage: https://github.com/ivanom/rbcss
104
104
  licenses:
105
105
  - MIT
106
106
  metadata: {}
@@ -110,17 +110,17 @@ require_paths:
110
110
  - lib
111
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - ">="
113
+ - - '>='
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - ">="
118
+ - - '>='
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.4.2
123
+ rubygems_version: 2.4.6
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: A Ruby DSL to generate css.