Class: Furud::Adjustment

Inherits:
Data
  • Object
show all
Defined in:
lib/furud/types.rb,
sig/furud.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, sheet: nil, at:, count: 1) ⇒ Adjustment

Returns a new instance of Adjustment.

Parameters:

  • type: (Symbol)
  • sheet: (String, nil) (defaults to: nil)
  • at: (Integer)
  • count: (Integer) (defaults to: 1)

Raises:

  • (ArgumentError)


47
48
49
50
51
52
53
54
# File 'lib/furud/types.rb', line 47

def initialize(type:, sheet: nil, at:, count: 1)
  type = type.to_sym
  raise ArgumentError, "type must be insert_rows, delete_rows, insert_columns, or delete_columns" unless
    i[insert_rows delete_rows insert_columns delete_columns].include?(type)
  raise ArgumentError, "at and count must be positive" unless Integer(at).positive? && Integer(count).positive?

  super(type: type, sheet: sheet&.to_s, at: Integer(at), count: Integer(count))
end

Instance Attribute Details

#at ⇒ Object (readonly)

Returns the value of attribute at

Returns:

  • (Object) —

    the current value of at



46
47
48
# File 'lib/furud/types.rb', line 46

def at
  @at
end

#count ⇒ Object (readonly)

Returns the value of attribute count

Returns:

  • (Object) —

    the current value of count



46
47
48
# File 'lib/furud/types.rb', line 46

def count
  @count
end

#sheet ⇒ Object (readonly)

Returns the value of attribute sheet

Returns:

  • (Object) —

    the current value of sheet



46
47
48
# File 'lib/furud/types.rb', line 46

def sheet
  @sheet
end

#type ⇒ Object (readonly)

Returns the value of attribute type

Returns:

  • (Object) —

    the current value of type



46
47
48
# File 'lib/furud/types.rb', line 46

def type
  @type
end