Module: Skeevy::Cutter

Included in:
Skeevy::Cutters::StandardKey
Defined in:
lib/skeevy/cutter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#delimiterObject (readonly)

Returns the value of attribute delimiter.



5
6
7
# File 'lib/skeevy/cutter.rb', line 5

def delimiter
  @delimiter
end

#instanceObject

Returns the value of attribute instance.



4
5
6
# File 'lib/skeevy/cutter.rb', line 4

def instance
  @instance
end

#prefixObject (readonly)

Returns the value of attribute prefix.



6
7
8
# File 'lib/skeevy/cutter.rb', line 6

def prefix
  @prefix
end

Instance Method Details

#cut(hash:, ns:, object: nil) ⇒ Object

Raises:

  • (NoMethodError)


18
19
20
# File 'lib/skeevy/cutter.rb', line 18

def cut(hash:, ns:, object: nil)
  raise NoMethodError, "Your Cutter is invalid."
end

#initialize(instance: nil, delimiter: '-', prefix: nil) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
# File 'lib/skeevy/cutter.rb', line 8

def initialize(instance: nil, delimiter: '-', prefix: nil)
  raise(ArgumentError, "Unable to init Skeevy Cutters without a delimiter") if delimiter.nil?
  raise ArgumentError,
        "Instance passed was not a Skeevy::Instance" unless
      instance.is_a?(Skeevy::Instance) || instance.nil?
  @instance  = instance
  @delimiter = delimiter
  @prefix    = prefix
end