lafcadio 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lafcadio.rb +1 -1
- data/lib/lafcadio.rb~ +1 -1
- data/lib/lafcadio/objectField.rb +1 -1
- data/lib/lafcadio/objectField.rb~ +1 -1
- data/lib/lafcadio/query.rb +3 -3
- data/lib/lafcadio/query.rb~ +12 -5
- metadata +2 -2
data/lib/lafcadio.rb
CHANGED
data/lib/lafcadio.rb~
CHANGED
data/lib/lafcadio/objectField.rb
CHANGED
@@ -499,7 +499,7 @@ module Lafcadio
|
|
499
499
|
# postal code.
|
500
500
|
class StateField < EnumField
|
501
501
|
def initialize( domain_class, name = "state" )
|
502
|
-
super( domain_class, name,
|
502
|
+
super( domain_class, name, USCommerce::UsStates.states )
|
503
503
|
end
|
504
504
|
end
|
505
505
|
|
data/lib/lafcadio/query.rb
CHANGED
@@ -482,11 +482,11 @@ module Lafcadio
|
|
482
482
|
|
483
483
|
def get_regexp
|
484
484
|
if @matchType == PRE_AND_POST
|
485
|
-
Regexp.new(@searchTerm)
|
485
|
+
Regexp.new( @searchTerm, Regexp::IGNORECASE )
|
486
486
|
elsif @matchType == PRE_ONLY
|
487
|
-
Regexp.new(@searchTerm.to_s + "$")
|
487
|
+
Regexp.new( @searchTerm.to_s + "$", Regexp::IGNORECASE )
|
488
488
|
elsif @matchType == POST_ONLY
|
489
|
-
Regexp.new("^" + @searchTerm)
|
489
|
+
Regexp.new( "^" + @searchTerm, Regexp::IGNORECASE )
|
490
490
|
end
|
491
491
|
end
|
492
492
|
|
data/lib/lafcadio/query.rb~
CHANGED
@@ -354,25 +354,32 @@ module Lafcadio
|
|
354
354
|
def self.impostor( domain_class )
|
355
355
|
unless @@impostor_classes[domain_class]
|
356
356
|
i_class = Class.new
|
357
|
-
i_class.module_eval
|
357
|
+
i_class.module_eval <<-CLASS_DEF
|
358
358
|
attr_reader :domain_class
|
359
359
|
|
360
|
-
def initialize; @domain_class = domain_class; end
|
360
|
+
def initialize; @domain_class = #{ domain_class.name }; end
|
361
361
|
|
362
362
|
def method_missing( methId, *args )
|
363
363
|
fieldName = methId.id2name
|
364
364
|
begin
|
365
|
-
classField =
|
365
|
+
classField = self.domain_class.get_field( fieldName )
|
366
366
|
ObjectFieldImpostor.new( self, classField )
|
367
367
|
rescue MissingError
|
368
368
|
super( methId, *args )
|
369
369
|
end
|
370
370
|
end
|
371
|
-
|
371
|
+
|
372
|
+
#{ domain_class.name }.class_fields.each do |class_field|
|
373
|
+
begin
|
374
|
+
undef_method class_field.name.to_sym
|
375
|
+
rescue NameError
|
376
|
+
# not defined globally or in an included Module, skip it
|
377
|
+
end
|
378
|
+
end
|
379
|
+
CLASS_DEF
|
372
380
|
@@impostor_classes[domain_class] = i_class
|
373
381
|
end
|
374
382
|
i_class = @@impostor_classes[domain_class]
|
375
|
-
puts i_class.new.domain_class.name
|
376
383
|
i_class.new
|
377
384
|
end
|
378
385
|
end
|
metadata
CHANGED