Class: BerkeleyLibrary::AV::Restrictions

Inherits:
Object
  • Object
show all
Defined in:
lib/berkeley_library/av/restrictions.rb

Constant Summary collapse

SUBFIELD_VALUE_SPECS =

TODO: remove 85642$y and 95640$z once we confirm all records have 998$r

%w[998$r/#-# 856$y/#-#{^1=\4}{^2=\2} 956$z/#-#{^1=\4}{^2=\0}].freeze
RE_CALNET_ONLY =
/CalNet/i
RE_CALNET_OR_IP =
/UCB access|UCB only/i

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(marc_record) ⇒ Restrictions

Returns a new instance of Restrictions.



13
14
15
# File 'lib/berkeley_library/av/restrictions.rb', line 13

def initialize(marc_record)
  @marc_record = marc_record
end

Instance Attribute Details

#marc_recordObject (readonly)

Returns the value of attribute marc_record.



11
12
13
# File 'lib/berkeley_library/av/restrictions.rb', line 11

def marc_record
  @marc_record
end

Instance Method Details

#calnet_only?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/berkeley_library/av/restrictions.rb', line 17

def calnet_only?
  @calnet ||= any_field_value_matches?(RE_CALNET_ONLY)
end

#calnet_or_ip?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/berkeley_library/av/restrictions.rb', line 21

def calnet_or_ip?
  @ucb_ip ||= any_field_value_matches?(RE_CALNET_OR_IP)
end