Class: Aio::Base::Toolkit::Hash::StringConcat

Inherits:
Struct
  • Object
show all
Defined in:
lib/aio/base/toolkit/hash.rb

Overview

建立一个结构体,方便包含cm的类型进行比较

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line, cm_type) ⇒ StringConcat

Returns a new instance of StringConcat.



66
67
68
69
70
71
72
# File 'lib/aio/base/toolkit/hash.rb', line 66

def initialize(line, cm_type)
  super(
    line,
    long_name(line),
    cm_type
  )
end

Instance Attribute Details

#cm_typeObject

Returns the value of attribute cm_type

Returns:

  • (Object)

    the current value of cm_type



65
66
67
# File 'lib/aio/base/toolkit/hash.rb', line 65

def cm_type
  @cm_type
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



65
66
67
# File 'lib/aio/base/toolkit/hash.rb', line 65

def line
  @line
end

#stringObject

Returns the value of attribute string

Returns:

  • (Object)

    the current value of string



65
66
67
# File 'lib/aio/base/toolkit/hash.rb', line 65

def string
  @string
end

Instance Method Details

#eql?(other) ⇒ Boolean

判断与另一个StringConcat是否相等

Returns:

  • (Boolean)


81
82
83
# File 'lib/aio/base/toolkit/hash.rb', line 81

def eql?(other)
  self.string == other.string
end

#inspectObject



85
86
87
# File 'lib/aio/base/toolkit/hash.rb', line 85

def inspect
  self.line
end

#long_name(arr) ⇒ Object



74
75
76
77
78
# File 'lib/aio/base/toolkit/hash.rb', line 74

def long_name(arr)
  res = ''
  arr.each { |x| res += x.to_s }
  res
end

#to_sObject



89
90
91
# File 'lib/aio/base/toolkit/hash.rb', line 89

def to_s
  self.string
end