m9t 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/m9t.rb +1 -1
  2. data/lib/m9t/base.rb +17 -3
  3. metadata +2 -2
data/lib/m9t.rb CHANGED
@@ -37,7 +37,7 @@ module M9t
37
37
  module VERSION #:nodoc:
38
38
  MAJOR = 0
39
39
  MINOR = 1
40
- TINY = 3
40
+ TINY = 4
41
41
 
42
42
  STRING = [MAJOR, MINOR, TINY].join('.')
43
43
  end
@@ -6,9 +6,18 @@ module M9t
6
6
 
7
7
  module Base
8
8
 
9
- def self.included(base) #:nodoc:
9
+ def self.add_options(klass)
10
+
11
+ klass.instance_eval do
12
+
13
+ # Make sure derived classes get the extra methods
14
+ def inherited(sub) #:nodoc:
15
+ sub.instance_eval do
16
+ M9t::Base.add_options(sub)
17
+ end
18
+ puts "New subclass: #{sub}"
19
+ end
10
20
 
11
- base.instance_eval do
12
21
  # Returns the classes current options - see the specific class for defaults
13
22
  def options
14
23
  @options
@@ -20,7 +29,7 @@ module M9t
20
29
  end
21
30
 
22
31
  # The name used for i18n translations
23
- # E.g. M9t::Distance => 'distance'
32
+ # M9t::Distance => 'distance'
24
33
  def measurement_name
25
34
  name.downcase.split('::')[1]
26
35
  end
@@ -30,6 +39,11 @@ module M9t
30
39
 
31
40
  end
32
41
 
42
+ # Adds methods for handling options
43
+ def self.included(base) #:nodoc:
44
+ M9t::Base.add_options(base)
45
+ end
46
+
33
47
  attr_reader :value, :options
34
48
 
35
49
  # ==== Parameters
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joe Yates