morph 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.2.7. handle dash when converting to method name, reported by danwrong
2
+
1
3
  v0.2.6. handle more types of value types in from_hash()
2
4
 
3
5
  v0.2.5. camelize names for classes in from_hash()
data/lib/morph.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'activesupport'
2
2
 
3
3
  module Morph
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.7"
5
5
 
6
6
  class << self
7
7
  def generate_migrations object, options={}
@@ -241,7 +241,7 @@ module Morph
241
241
  end
242
242
 
243
243
  def convert_to_morph_method_name label
244
- name = label.to_s.downcase.tr('()*',' ').gsub('%','percentage').strip.chomp(':').strip.gsub(/\s/,'_').squeeze('_')
244
+ name = label.to_s.downcase.tr('()\-*',' ').gsub('%','percentage').strip.chomp(':').strip.gsub(/\s/,'_').squeeze('_')
245
245
  name = '_'+name if name =~ /^\d/
246
246
  name
247
247
  end
data/morph.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{morph}
5
- s.version = "0.2.6"
5
+ s.version = "0.2.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Rob McKinnon"]
9
- s.date = %q{2009-03-30}
9
+ s.date = %q{2009-04-13}
10
10
  s.description = %q{Morph allows you to emerge class definitions via calling assignment methods; mix with Hpricot for screen scrapping fun.}
11
11
  s.email = ["rob ~@nospam@~ rubyforge.org"]
12
12
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README"]
@@ -313,6 +313,9 @@ describe Morph do
313
313
 
314
314
  include MorphSpecHelperMethods
315
315
 
316
+ it 'should covert dash to underscore' do
317
+ check_convert_to_morph_method_name 'hi-time', 'hi_time'
318
+ end
316
319
  it 'should upper case to lower case' do
317
320
  check_convert_to_morph_method_name 'CaSe', 'case'
318
321
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob McKinnon
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-30 00:00:00 +01:00
12
+ date: 2009-04-13 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency