class AEMO::Region
@author Joel Courtney @abstract @since 0.1.0
Constants
- CATEGORY
- CLASSIFICATION
- DISPATCH_TYPE
- REGIONS
Regions under juristiction
Attributes
aemo_market_node[R]
region[RW]
Public Class Methods
all()
click to toggle source
# File lib/aemo/region.rb, line 26 def all REGIONS.keys.map { |k| AEMO::Region.new(k) } end
new(region)
click to toggle source
Create a new instance of AEMO::Region
@param [String] region State @return [self]
# File lib/aemo/region.rb, line 35 def initialize(region) raise ArgumentError, "Region '#{region}' is not valid." unless valid_region?(region) @region = region.upcase @full_name = REGIONS[@region] @current_trading = [] @current_dispatch = [] @aemo_market_node = if %w[NSW QLD SA TAS VIC].include?(@region) AEMO::Market::Node.new(region) elsif @region == 'ACT' AEMO::Market::Node.new('NSW') end end
Public Instance Methods
abbr()
click to toggle source
Abbreviation method
@return [String]
# File lib/aemo/region.rb, line 51 def abbr @region end
current_dispatch()
click to toggle source
Return the current dispatch data
@return [Array<AEMO::Market::Interval>]
# File lib/aemo/region.rb, line 68 def current_dispatch @aemo_market_node.current_dispatch end
current_trading()
click to toggle source
Return the current trading data
@return [Array<AEMO::Market::Interval>]
# File lib/aemo/region.rb, line 75 def current_trading @aemo_market_node.current_trading end
fullname()
click to toggle source
@return [String]
# File lib/aemo/region.rb, line 61 def fullname REGIONS[@region] end
to_s()
click to toggle source
@return [String]
# File lib/aemo/region.rb, line 56 def to_s @region end
Protected Instance Methods
valid_region?(region)
click to toggle source
Validates a region
@param [String] region @return [Boolean]
# File lib/aemo/region.rb, line 85 def valid_region?(region) REGIONS.keys.include?(region.upcase) end