Module: Skeevy::Cutter
- Included in:
- Skeevy::Cutters::StandardKey
- Defined in:
- lib/skeevy/cutter.rb
Instance Attribute Summary collapse
-
#delimiter ⇒ Object
readonly
Returns the value of attribute delimiter.
-
#instance ⇒ Object
Returns the value of attribute instance.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
- #cut(hash:, ns:, object: nil) ⇒ Object
- #initialize(instance: nil, delimiter: '-', prefix: nil) ⇒ Object
Instance Attribute Details
#delimiter ⇒ Object (readonly)
Returns the value of attribute delimiter.
5 6 7 |
# File 'lib/skeevy/cutter.rb', line 5 def delimiter @delimiter end |
#instance ⇒ Object
Returns the value of attribute instance.
4 5 6 |
# File 'lib/skeevy/cutter.rb', line 4 def instance @instance end |
#prefix ⇒ Object (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
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
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 |