Class: Megam::CloudInstructionGroup
- Inherits:
-
Object
- Object
- Megam::CloudInstructionGroup
- Defined in:
- lib/megam/core/cloudinstruction_group.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cloud_instructions_array(arg = nil) ⇒ Object
- #cloudinstruction_group ⇒ Object
- #error? ⇒ Boolean
- #for_json ⇒ Object
- #from_hash(o) ⇒ Object
- #group(arg = nil) ⇒ Object
-
#initialize ⇒ CloudInstructionGroup
constructor
A new instance of CloudInstructionGroup.
-
#to_hash ⇒ Object
Transform the ruby obj -> to a Hash.
-
#to_json(*a) ⇒ Object
Serialize this object as a hash: called from JsonCompat.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ CloudInstructionGroup
Returns a new instance of CloudInstructionGroup.
18 19 20 21 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 18 def initialize @group = nil @cloud_instructions_array = nil end |
Class Method Details
.from_hash(o) ⇒ Object
82 83 84 85 86 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 82 def self.from_hash(o) cloudinstruction_group = self.new() cloudinstruction_group.from_hash(o) cloudinstruction_group end |
.json_create(o) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 75 def self.json_create(o) cloudinstruction_group = new cloudinstruction_group.group(o["group"]) if o.has_key?("group") cloudinstruction_group.cloud_instructions_array(o["results"]) if o.has_key?("results") cloudinstruction_group end |
Instance Method Details
#cloud_instructions_array(arg = nil) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 35 def cloud_instructions_array(arg=nil) if arg != nil @cloud_instructions_array = arg else @cloud_instructions_array end end |
#cloudinstruction_group ⇒ Object
23 24 25 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 23 def cloudinstruction_group self end |
#error? ⇒ Boolean
44 45 46 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 44 def error? crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error") end |
#for_json ⇒ Object
67 68 69 70 71 72 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 67 def for_json result = { "group" => group } result end |
#from_hash(o) ⇒ Object
88 89 90 91 92 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 88 def from_hash(o) @group = o[:group] if o.has_key?(:group) @cloudinstructions = o[:cloud_instructions_array] if o.has_key?(:cloud_instructions_array) self end |
#group(arg = nil) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 27 def group(arg=nil) if arg != nil @group = arg else @group end end |
#to_hash ⇒ Object
Transform the ruby obj -> to a Hash
51 52 53 54 55 56 57 58 59 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 51 def to_hash index_hash = Hash.new index_hash["json_claz"] = self.class.name index_hash["group"] = group cloud_instructions_array.each do |single_cig| index_hash[""] = single_cig end index_hash end |
#to_json(*a) ⇒ Object
Serialize this object as a hash: called from JsonCompat. Verify if this called from JsonCompat during testing.
63 64 65 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 63 def to_json(*a) for_json.to_json(*a) end |
#to_s ⇒ Object
94 95 96 |
# File 'lib/megam/core/cloudinstruction_group.rb', line 94 def to_s Megam::Stuff.styled_hash(to_hash) end |