plastic_cup 0.1.1 → 0.1.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
- ZTcyZjliNGZhNGY1YmMyZjliNzFiMmE3NTMxZWM4ZmYwMmZhNjNkMA==
4
+ ZDUyY2MzNDVkMGE0N2JhMGIyZmUyNWQ4MzU2MThiMmI5ZjU1MDZkNg==
5
5
  data.tar.gz: !binary |-
6
- MTY0Yzc5MjY4NzllMDk4ZjZkMTQyMWQwMzcxMTFiOTkyZThmMDkxNw==
7
- !binary "U0hBNTEy":
6
+ NDM3MWNhNTc4OTg2M2ZmYzEwMzU2MWQxMjA0MTM3OGIxOGNkOTcwMA==
7
+ SHA512:
8
8
  metadata.gz: !binary |-
9
- NzlkODA5MWJmNmFhMDYzNDE3YWRmMTBhMjU5MWZjZWQ3MjgxZDhhNDE0MTNl
10
- YmU5MGEzOTI4MDQ3NTExNjgwYWU0YmYwYjQ2MjgyNWJkNTg3MzZkYTdkNjUz
11
- N2UxNGEzYjcyODJlODU5ZDIwMzhiZTlkMDNlMzhlYzdmYTRkYzg=
9
+ OTQ1N2ZiMDJkMmQ2YzhlNGRmMzlmY2RkOTdjZDIwNDI1NzUxZWQ5MjcxZTJj
10
+ MTYxMmUyNmM1NzFhNDE3ZGI4MjQ1MGM3OTcyOGZhMDcxMDU3N2JlM2MxMjA1
11
+ OGY0ZTIyMjE5NDA2NjE1YTIzMmIwMTRlMTRhMWU1ODk2MDFlYTY=
12
12
  data.tar.gz: !binary |-
13
- ODFhMzU2MjcyNmQxOTQ2ODY2ODA4YTc4MTllZDZiOTZjOTEzMjcyYmVhZDkw
14
- Yjc3OGUxNTZiZGEzNTZiZmM4NmE3NzhmZjliMjFjOTgxMzdjMGY4OTlkZTA1
15
- MDMwZDBlOWFlNDFiZWRjY2U4NTViM2M5MzZhNWE4YWJhYWE3ODM=
13
+ Y2FkZDljMjllN2FhM2ZkNTE4OTNjYWQ5OWQ3N2U1YzA2Mzc4NTBlMDY5Nzgy
14
+ ZTk5MGZiMzU3OWI2NTkxMDU0ZTM1ZDZjNDJmNDY1ZjdjZWY1NjU4MGM3YjM1
15
+ ZGIzMGMxYjIyMmJiZTNhNDk0OWYzNGY4OWUyNjFiODFiOWU0Mzc=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- plastic_cup (0.1.1)
4
+ plastic_cup (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -17,6 +17,7 @@ PlasticCup::Base.add_style_sheet(:red_button, {
17
17
  backgroundColor: UIColor.redColor
18
18
  })
19
19
  @button = PlasticCup::Base.style(UIButton.new, :red_button)
20
+ @button2 = PlasticCup::Base.style(UIButton.new, :red_button, title: 'Another Red')
20
21
  ```
21
22
 
22
23
  Style with extend Stylesheet
@@ -4,9 +4,11 @@ module PlasticCup
4
4
 
5
5
  OSVersions = %w(all ios4 ios5 ios6 ios7)
6
6
 
7
- def self.style(target, style)
7
+ def self.style(target, style, other_style=nil)
8
8
  if style.is_a?(Hash)
9
9
  apply_properties(target, style)
10
+ elsif other_style.is_a?(Hash)
11
+ apply_properties(target, get_style_sheet_properties(style).merge(other_style))
10
12
  else
11
13
  apply_properties(target, get_style_sheet_properties(style))
12
14
  end
@@ -1,3 +1,3 @@
1
1
  module PlasticCup
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/spec/base_spec.rb CHANGED
@@ -73,6 +73,24 @@ describe 'PlasticCup::Base' do
73
73
  field.placeholder.should == 'Mother placeholder'
74
74
  end
75
75
 
76
+ it 'should support additional style' do
77
+ PlasticCup::Base.add_style_sheet(:my_style, {textAlignment: 3})
78
+
79
+ field = PlasticCup::Base.style(UITextField.new, :my_style, text: 'My Style Text')
80
+
81
+ field.textAlignment.should == 3
82
+ field.text.should == 'My Style Text'
83
+ end
84
+
85
+ it 'should support additional style overriding style sheet' do
86
+ PlasticCup::Base.add_style_sheet(:my_style, {textAlignment: 3, placeholder: 'Mother placeholder'})
87
+
88
+ field = PlasticCup::Base.style(UITextField.new, :my_style, text: 'My Style Text', placeholder: 'My placeholder')
89
+
90
+ field.textAlignment.should == 3
91
+ field.text.should == 'My Style Text'
92
+ field.placeholder.should == 'My placeholder'
93
+ end
76
94
  end
77
95
 
78
96
  describe '#add_style_sheet and #get_style_sheet' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plastic_cup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - April Tsang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-10 00:00:00.000000000 Z
11
+ date: 2014-05-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ! 'Plastic Cup is a simplified version of Teacup, aiming at memory leak
14
14
  prevention.
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  version: '0'
62
62
  requirements: []
63
63
  rubyforge_project:
64
- rubygems_version: 2.0.7
64
+ rubygems_version: 2.2.1
65
65
  signing_key:
66
66
  specification_version: 4
67
67
  summary: A rubymotion gem for assigning properties to object by hash.