revent 0.6.2 → 0.6.3

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.
Files changed (2) hide show
  1. data/lib/revent/amf3/util/vo_helper.rb +12 -9
  2. metadata +3 -3
@@ -6,10 +6,10 @@ module RubyAMF
6
6
 
7
7
  require "#{File.dirname(__FILE__)}/../app/configuration" # cant put this at the top because VoHash has to be instantiated for app/configuration to work
8
8
  class VoUtil
9
-
9
+
10
10
  include RubyAMF::Configuration
11
11
  include RubyAMF::Exceptions
12
-
12
+
13
13
  #moved logic here so AMF3 and AMF0 can use it
14
14
  def self.get_vo_for_incoming(obj,action_class_name)
15
15
  if (mapping = ClassMappings.get_vo_mapping_for_actionscript_class(action_class_name)) || ## if there is a map use, that class
@@ -17,7 +17,7 @@ module RubyAMF
17
17
  if mapping #if there's a map, then we default to it's specification.
18
18
  obj.reject!{|k,v| mapping[:ignore_fields][k]}
19
19
  ruby_obj = mapping[:ruby].constantize.new
20
- end
20
+ end
21
21
  if ruby_obj.is_a?(ActiveRecord::Base) # put all the attributes fields into the attribute instance variable
22
22
  attributes = {} # extract attributes
23
23
  if mapping
@@ -40,7 +40,7 @@ module RubyAMF
40
40
  obj.each_key do |field|
41
41
  if reflection = ruby_obj.class.reflections[field.to_sym] # is it an association
42
42
  value = obj.delete(field) # get rid of the field so it doesnt get added in the next loop
43
- case reflection.macro
43
+ case reflection.macro
44
44
  when :has_one
45
45
  ruby_obj.send("set_#{field}_target", value)
46
46
  when :belongs_to
@@ -59,14 +59,17 @@ module RubyAMF
59
59
  ruby_obj
60
60
  else # then we are still left with a normal hash, lets see if we need to change the type of the keys
61
61
  case ClassMappings.hash_key_access
62
- when :symbol : obj.symbolize_keys!
63
- when :string : obj # by default the keys are a string type, so just return the obj
64
- when :indifferent : HashWithIndifferentAccess.new(obj)
62
+ when :symbol
63
+ obj.symbolize_keys!
64
+ when :string
65
+ obj # by default the keys are a string type, so just return the obj
66
+ when :indifferent
67
+ HashWithIndifferentAccess.new(obj)
65
68
  # else # TODO: maybe add a raise FlexError since they somehow put the wrong value for this feature
66
69
  end
67
70
  end
68
71
  end
69
-
72
+
70
73
  # Aryk: I tried to make this more efficent and clean.
71
74
  def self.get_vo_hash_for_outgoing(obj)
72
75
  new_object = VoHash.new #use VoHash because one day, we might do away with the class Object patching
@@ -89,7 +92,7 @@ module RubyAMF
89
92
  instance_vars = obj.instance_variables.reject{|assoc| ["@attributes","@new_record","@read_only"].include?(assoc)}
90
93
  end
91
94
  end
92
- new_object._explicitType = map[:actionscript] # Aryk: This only works on the Hash because rubyAMF extended class Object to have this accessor, probably not the best idea, but its already there.
95
+ new_object._explicitType = map[:actionscript] # Aryk: This only works on the Hash because rubyAMF extended class Object to have this accessor, probably not the best idea, but its already there.
93
96
  # Tony: There's some duplication in here. Had trouble consolidating the logic though. Ruby skills failed.
94
97
  elsif ClassMappings.assume_types
95
98
  new_object._explicitType = obj.class.to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ngoc DAO Thanh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-31 00:00:00 +09:00
12
+ date: 2009-03-11 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  requirements: []
107
107
 
108
108
  rubyforge_project: revent
109
- rubygems_version: 1.3.0
109
+ rubygems_version: 1.3.1
110
110
  signing_key:
111
111
  specification_version: 2
112
112
  summary: RPC based on EventMachine