Class: ReactOnRailsPro::RendererArtifact::Identity

Inherits:
Data
  • Object
show all
Defined in:
lib/react_on_rails_pro/renderer_artifact.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(role:, id:) ⇒ Identity

Returns a new instance of Identity.



31
32
33
34
35
36
37
38
39
# File 'lib/react_on_rails_pro/renderer_artifact.rb', line 31

def initialize(role:, id:)
  normalized_role = role.to_sym
  normalized_id = id.to_s.freeze
  unless RendererArtifact.role_from_id(normalized_id) == normalized_role
    raise ArgumentError, "Renderer artifact identity does not match role #{normalized_role.inspect}"
  end

  super(role: normalized_role, id: normalized_id)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



30
31
32
# File 'lib/react_on_rails_pro/renderer_artifact.rb', line 30

def id
  @id
end

#roleObject (readonly)

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



30
31
32
# File 'lib/react_on_rails_pro/renderer_artifact.rb', line 30

def role
  @role
end