Class: DesignByContract::Signature::Spec

Inherits:
Object
  • Object
show all
Defined in:
lib/design_by_contract/signature/spec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_args_spec) ⇒ Spec

Returns a new instance of Spec.



4
5
6
# File 'lib/design_by_contract/signature/spec.rb', line 4

def initialize(method_args_spec)
  @type, @keyword, @interface = format(method_args_spec)
end

Instance Attribute Details

#interfaceObject (readonly)

Returns the value of attribute interface.



2
3
4
# File 'lib/design_by_contract/signature/spec.rb', line 2

def interface
  @interface
end

#keywordObject (readonly)

Returns the value of attribute keyword.



2
3
4
# File 'lib/design_by_contract/signature/spec.rb', line 2

def keyword
  @keyword
end

#typeObject (readonly)

Returns the value of attribute type.



2
3
4
# File 'lib/design_by_contract/signature/spec.rb', line 2

def type
  @type
end

Instance Method Details

#==(oth_spec) ⇒ Object



8
9
10
11
12
# File 'lib/design_by_contract/signature/spec.rb', line 8

def ==(oth_spec)
  type == oth_spec.type &&
    keyword == oth_spec.keyword &&
    interface == oth_spec.interface
end

#rawObject



14
15
16
# File 'lib/design_by_contract/signature/spec.rb', line 14

def raw
  [type, keyword, interface.raw]
end