Class: Cadenya::Types::MCP_Annotations

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title: nil, read_only_hint: nil, destructive_hint: nil, idempotent_hint: nil, open_world_hint: nil) ⇒ MCP_Annotations

Returns a new instance of MCP_Annotations.



3022
3023
3024
3025
3026
3027
3028
# File 'lib/cadenya/types.rb', line 3022

def initialize(title: nil, read_only_hint: nil, destructive_hint: nil, idempotent_hint: nil, open_world_hint: nil)
  @title = title
  @read_only_hint = read_only_hint
  @destructive_hint = destructive_hint
  @idempotent_hint = idempotent_hint
  @open_world_hint = open_world_hint
end

Instance Attribute Details

#destructive_hintObject (readonly)

Returns the value of attribute destructive_hint.



3020
3021
3022
# File 'lib/cadenya/types.rb', line 3020

def destructive_hint
  @destructive_hint
end

#idempotent_hintObject (readonly)

Returns the value of attribute idempotent_hint.



3020
3021
3022
# File 'lib/cadenya/types.rb', line 3020

def idempotent_hint
  @idempotent_hint
end

#open_world_hintObject (readonly)

Returns the value of attribute open_world_hint.



3020
3021
3022
# File 'lib/cadenya/types.rb', line 3020

def open_world_hint
  @open_world_hint
end

#read_only_hintObject (readonly)

Returns the value of attribute read_only_hint.



3020
3021
3022
# File 'lib/cadenya/types.rb', line 3020

def read_only_hint
  @read_only_hint
end

#titleObject (readonly)

Returns the value of attribute title.



3020
3021
3022
# File 'lib/cadenya/types.rb', line 3020

def title
  @title
end

Class Method Details

.from_json(data) ⇒ Object



3030
3031
3032
3033
3034
3035
3036
3037
3038
# File 'lib/cadenya/types.rb', line 3030

def self.from_json(data)
  new(
    title: data["title"],
    read_only_hint: data["readOnlyHint"],
    destructive_hint: data["destructiveHint"],
    idempotent_hint: data["idempotentHint"],
    open_world_hint: data["openWorldHint"],
  )
end

Instance Method Details

#to_hObject



3040
3041
3042
3043
3044
3045
3046
3047
3048
# File 'lib/cadenya/types.rb', line 3040

def to_h
  {
    title: Util.plain(@title),
    read_only_hint: Util.plain(@read_only_hint),
    destructive_hint: Util.plain(@destructive_hint),
    idempotent_hint: Util.plain(@idempotent_hint),
    open_world_hint: Util.plain(@open_world_hint),
  }.reject { |_k, v| v.nil? }
end