Class: Cubism::BlockContainer
- Inherits:
 - 
      Struct
      
        
- Object
 - Struct
 - Cubism::BlockContainer
 
 
- Defined in:
 - lib/cubism/cubicle_store.rb
 
Overview
Container for cubicle blocks
Instance Attribute Summary collapse
- 
  
    
      #block_location  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute block_location.
 - 
  
    
      #block_source  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute block_source.
 - 
  
    
      #resource_gid  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute resource_gid.
 - 
  
    
      #scope  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute scope.
 - 
  
    
      #user_gid  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    
Returns the value of attribute user_gid.
 
Instance Method Summary collapse
- #digest ⇒ Object
 - 
  
    
      #initialize(*args)  ⇒ BlockContainer 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of BlockContainer.
 - #marshal_dump ⇒ Object
 - #marshal_load(serialized_item) ⇒ Object
 - #resource ⇒ Object
 - #user ⇒ Object
 
Constructor Details
#initialize(*args) ⇒ BlockContainer
Returns a new instance of BlockContainer.
      55 56 57 58 59  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 55 def initialize(*args) super @filename, _lineno = block_location.split(":") end  | 
  
Instance Attribute Details
#block_location ⇒ Object
Returns the value of attribute block_location
      47 48 49  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 47 def block_location @block_location end  | 
  
#block_source ⇒ Object
Returns the value of attribute block_source
      47 48 49  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 47 def block_source @block_source end  | 
  
#resource_gid ⇒ Object
Returns the value of attribute resource_gid
      47 48 49  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 47 def resource_gid @resource_gid end  | 
  
#scope ⇒ Object
Returns the value of attribute scope
      47 48 49  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 47 def scope @scope end  | 
  
#user_gid ⇒ Object
Returns the value of attribute user_gid
      47 48 49  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 47 def user_gid @user_gid end  | 
  
Instance Method Details
#digest ⇒ Object
      73 74 75 76 77  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 73 def digest resource_user_key = [resource_gid, user_gid, scope].join(":") ActiveSupport::Digest.hexdigest("#{block_location}:#{File.read(@filename)}:#{resource_user_key}") end  | 
  
#marshal_dump ⇒ Object
      79 80 81  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 79 def marshal_dump to_h.merge(block_source: block_source.digest) end  | 
  
#marshal_load(serialized_item) ⇒ Object
      83 84 85 86 87 88 89  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 83 def marshal_load(serialized_item) members.excluding(:block_source).each do |arg| send("#{arg}=", serialized_item[arg]) end self.block_source = Cubism.source_store[serialized_item[:block_source]] end  | 
  
#resource ⇒ Object
      65 66 67  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 65 def resource GlobalID::Locator.locate self[:resource_gid] end  | 
  
#user ⇒ Object
      61 62 63  | 
    
      # File 'lib/cubism/cubicle_store.rb', line 61 def user GlobalID::Locator.locate self[:user_gid] end  |