Class: Vishnu::StandardTime::Plan::Block

Inherits:
Struct
  • Object
show all
Defined in:
lib/vishnu/standard_time.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#flowsObject

Returns the value of attribute flows

Returns:

  • (Object)

    the current value of flows



121
122
123
# File 'lib/vishnu/standard_time.rb', line 121

def flows
  @flows
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



121
122
123
# File 'lib/vishnu/standard_time.rb', line 121

def name
  @name
end

Instance Method Details

#minutesObject



122
123
124
# File 'lib/vishnu/standard_time.rb', line 122

def minutes
  Vishnu::StandardTime.minutes_for(flows: flows)
end

#percent_of_dayObject



126
127
128
# File 'lib/vishnu/standard_time.rb', line 126

def percent_of_day
  (flows.to_f / Vishnu::StandardTime::FLOWS_PER_DAY) * 100
end

#to_hObject



130
131
132
133
134
135
136
137
# File 'lib/vishnu/standard_time.rb', line 130

def to_h
  {
    name: name,
    flows: flows,
    minutes: minutes,
    percent_of_day: percent_of_day.round(4)
  }
end