hypo 0.5.1 → 0.5.2

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: 6a568762c3ceb89a2a64afb118ee297054e9288a
4
- data.tar.gz: e22d7dd48cea4a09f4d6bb6003045d39a8b6d505
3
+ metadata.gz: 11b617d07d312984ef5942f39710c8485a96f81b
4
+ data.tar.gz: 9c1f1b23dc86f54612c4f2d5f14c0cae5c808fc9
5
5
  SHA512:
6
- metadata.gz: 696ad8bfc6f318a2a49de9516d17dd6dfb7ead86a68a400bff487bec442ee422ad12d2e884147b2c66d66b7cfcb863127ff8b1737550b4bc7d54aa1bf9747ab9
7
- data.tar.gz: e989c62ad5192c8ddab75dbc1cf8bc7f1754216e7cfda1d4e9d548dfcd6176311a18c277377c46d62249b3a0ef3d7c03004acd1f1eacfd80364d3bf31e2d3194
6
+ metadata.gz: 940a6fa8eee66b8ea88cf87f65d4eeaded5072daf75fca8496bad2a86f11038a13f87950702fc65a5ce50494085f47d6fbae20c0597787e8a4a006998f9a878a
7
+ data.tar.gz: 497f31732dce3870a86870460e6bf181dde6fa2756145a5b848f9f8b39a32bd055a2b23fb9af0346345e573c301520cdaf85a0bcb93361309b6eef0c8aa90cce
data/README.md CHANGED
@@ -77,16 +77,16 @@ container.register(connection, :connection)
77
77
  ```
78
78
  You must specify component name as it's done in example above.
79
79
 
80
- ## Component Lifetime
81
- By default all registered components have lifestyle Hypo::Transient.
80
+ ## Component Life Cycle
81
+ By default all registered components have life cycle Hypo::Transient.
82
82
  It means, every time when you resolve a component Hypo returns new instance of its type.
83
83
  If you wanna change this behavior then you can replace lifetime strategy.
84
84
  Out of the box Hypo provides Hypo::Singleton strategy, you can use it when register a component:
85
85
 
86
86
  ```ruby
87
- container.register(User).using_lifestyle(Hypo::Singleton)
87
+ container.register(User).using_life_cycle(Hypo::Singleton)
88
88
  ```
89
- Actually you can implement you own lifestyle,
89
+ Actually you can implement you own life cycle,
90
90
  i.e. makes sense to think about HttpRequest strategy for your web applications.
91
91
 
92
92
  ## Development
@@ -1,29 +1,29 @@
1
- require 'hypo/life_style/transient'
1
+ require 'hypo/life_cycle/transient'
2
2
 
3
3
  module Hypo
4
4
  class Component
5
- attr_reader :name, :type, :container, :lifestyle
5
+ attr_reader :name, :type, :container, :life_cycle
6
6
 
7
7
  def initialize(type, container, name = nil)
8
8
  @container = container
9
- @lifestyle = Transient.new(self)
9
+ @life_cycle = Transient.new(self)
10
10
 
11
11
  @type = type
12
12
  @name = name || type.name.gsub(/(.)([A-Z](?=[a-z]))/, '\1_\2').delete('::').downcase.to_sym
13
13
  end
14
14
 
15
15
  def instance
16
- @lifestyle.instance
16
+ @life_cycle.instance
17
17
  end
18
18
 
19
19
  def dependencies
20
20
  @type.instance_method(:initialize).parameters.map { |p| @container.resolve(p[1]) }
21
21
  end
22
22
 
23
- def use_lifestyle(lifestyle)
24
- @lifestyle = lifestyle.new(self)
23
+ def use_life_cycle(life_cycle)
24
+ @life_cycle = life_cycle.new(self)
25
25
  end
26
26
 
27
- alias using_lifestyle use_lifestyle
27
+ alias using_life_cycle use_life_cycle
28
28
  end
29
29
  end
File without changes
File without changes
data/lib/hypo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hypo
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hypo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Kalinkin
@@ -74,8 +74,8 @@ files:
74
74
  - lib/hypo/container.rb
75
75
  - lib/hypo/container_error.rb
76
76
  - lib/hypo/instance.rb
77
- - lib/hypo/life_style/singleton.rb
78
- - lib/hypo/life_style/transient.rb
77
+ - lib/hypo/life_cycle/singleton.rb
78
+ - lib/hypo/life_cycle/transient.rb
79
79
  - lib/hypo/version.rb
80
80
  homepage: https://github.com/cylon-v/hypo
81
81
  licenses: